一键启动zookeeper服务
#! /bin/sh
echo "start zkServer..."
for i in master server01 server02
do
echo "start zk"+$i+"启动中..."
ssh $i "source /etc/profile;/home/zy/modules/zookeeper-3.4.7/bin/zkServer.sh start"
done
/home/zy/modules/zookeeper-3.4.7/这里是我zookeeper在虚拟机里面的路径
一键停止zookeeper服务
#! /bin/sh
echo "start zkServer..."
for i in master server01 server02
do
echo "start zk"+$i+"停止中..."
ssh $i "source /etc/profile;/home/zy/modules/zookeeper-3.4.7/bin/zkServer.sh stop"
done
一键查看服务的状态
#! /bin/sh
echo "start zkServer..."
for i in master server01 server02
do
echo "start zk"+$i+"查询中..."
ssh $i "source /etc/profile;/home/zy/modules/zookeeper-3.4.7/bin/zkServer.sh status"
done
省事了很多