其他分享
首页 > 其他分享> > Zookeeper集群启动停止脚本

Zookeeper集群启动停止脚本

作者:互联网

目录

1)在hadoop102的/home/atguigu/bin目录下创建脚本

2)增加脚本执行权限

3)Zookeeper集群启动

4)Zookeeper集群停止

5)Zookeeper集群查看状态


1)在hadoop102的/home/atguigu/bin目录下创建脚本

[atguigu@hadoop102 bin]$ vim zk.sh
#!/bin/bash 

case $1 in
"start"){
 for i in hadoop102 hadoop103 hadoop104
 do
        echo ---------- zookeeper $i 启动 ------------ 
  ssh  $i  "/opt/module/zookeeper-3.5.7/bin/zkServer.sh start"
 done
}
;;
"stop"){
 for i in hadoop102 hadoop103 hadoop104
 do
        echo ---------- zookeeper $i 停止 ------------     
  ssh  $i  "/opt/module/zookeeper-3.5.7/bin/zkServer.sh stop"
 done
}
;;
"status"){
 for i in hadoop102 hadoop103 hadoop104
 do
        echo ---------- zookeeper $i 状态 ------------     
  ssh  $i  "/opt/module/zookeeper-3.5.7/bin/zkServer.sh status"
 done
}
;;
esac

2)增加脚本执行权限

[atguigu@hadoop102 bin]$ chmod 777 zk.sh

3)Zookeeper集群启动

[atguigu@hadoop102 module]$ zk.sh start

4)Zookeeper集群停止

[atguigu@hadoop102 module]$ zk.sh stop

5)Zookeeper集群查看状态

[atguigu@hadoop102 module]$ zk.sh status

标签:脚本,bin,zookeeper,Zookeeper,sh,集群,atguigu,hadoop102
来源: https://blog.csdn.net/weixin_43955488/article/details/122754469