Zookeeper启动停止脚本

1)在 hadoop102 的/home/hjl/bin 目录下创建脚本(根据用户名)

在脚本中编写如下内容

#!/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)增加脚本执行权限

chmod u+x zk.sh

3)Zookeeper 集群启动脚本

zk.sh start

Zookeeper启动停止脚本_第1张图片 

4)Zookeeper 集群停止脚本

zk.sh stop

Zookeeper启动停止脚本_第2张图片

 

你可能感兴趣的:(zookeeper)