创建zk.sh
case $1in"start"){ for i in hadoop102 hadoop103 hadoop104 doecho---------- zookeeper $i 启动 ------------ssh$i"/opt/module/zookeeper/bin/zkServer.sh start"done};; "stop"){ for i in hadoop102 hadoop103 hadoop104 doecho---------- zookeeper $i 停止 ------------ssh$i"/opt/module/zookeeper/bin/zkServer.sh stop"done};; "status"){ for i in hadoop102 hadoop103 hadoop104 doecho---------- zookeeper $i 状态 ------------ssh$i"/opt/module/zookeeper/bin/zkServer.sh status"done};; esac
增加脚本执行权限
chmod777 zk.sh
Zookeeper集群启动脚本
zk.sh start
Zookeeper集群停止脚本
zk.sh stop