启动zookeeper集群
#!/bin/sh
# zookeeper 集群启动shell脚本命令
echo "---------------------------------------------------------------------------"
echo "zookeeper start 172.16.1.8/9/10"
echo "...master-start..."
ssh master "source /etc/profile;zkServer.sh start"
echo "...slave1-start..."
ssh slave1 "source /etc/profile;zkServer.sh start"
echo "...slave2-start..."
ssh slave2 "source /etc/profile;zkServer.sh start"
echo "...all-start-end..."
echo "---------------------------------------------------------------------------"
查看zookeeper集群
#!/bin/sh
# zookeeper 集群状态shell脚本命令
echo "---------------------------------------------------------------------------"
echo "zookeeper status 172.16.1.8/9/10"
echo "...master-status..."
ssh master "source /etc/profile;zkServer.sh status"
echo "...slave1-status..."
ssh slave1 "source /etc/profile;zkServer.sh status"
echo "...slave2-status..."
ssh slave2 "source /etc/profile;zkServer.sh status"
echo "---------------------------------------------------------------------------"
停止zookeeper集群
#!/bin/sh
# zookeeper 集群停止shell脚本命令
echo "---------------------------------------------------------------------------"
echo "zookeeper start 172.16.1.8/9/10"
echo "...master-stop..."
ssh master "source /etc/profile;zkServer.sh stop"
echo "...slave1-stop..."
ssh slave1 "source /etc/profile;zkServer.sh stop"
echo "...slave2-stop..."
ssh slave2 "source /etc/profile;zkServer.sh stop"
echo "...all-stop-end..."
echo "---------------------------------------------------------------------------"
修改文件权限
chmod 755 ./*
chmod 755 zkStartCluster.sh
chmod 755 zkStatusCluster.sh
chmod 755 zkStopCluster.sh