#/bin/bash
# 执行此脚本需要使用支持shell的终端。如果windows有下载Git,双击自动用gitbash运行即可
ZKSERVERS=(1 2 3)
echo -e "\e[32m ========== 总共${#ZKSERVERS[@]}台服务器 ==========\e[0m \n"
# 请输入执行指令:start、stop、status等
read -p "请输入执行指令:" ORDER
# 遍历 begin
for SERVER in ${ZKSERVERS[@]}
do
echo -e "\n↓↓↓ \e[33m zookeeper $SERVER begin `date '+%Y-%m-%d %H:%M:%S'` \e[0m ↓↓↓\n"
E:/zookeeper3.6.1/module/zookeeper-3.6.1-$SERVER/bin/zkServer.sh $ORDER
done
# 遍历 end
echo -e "\n\e[32m ========== 自动化脚本任务执行完成 ==========\e[0m \n"
echo -e "jps:"
jps
read -p "按任意键退出..."
Zookeeper集群启动关闭查看状态...shell脚本
于 2020-08-03 21:11:51 首次发布