#! /bin/bash
#1、判断参数是否传入
if [ $# -lt 1 ]
then
echo "必须传入参数......"
exit
fi
#2、根据参数匹配动作
case $1 in
"start")
for host in hadoop102 hadoop103 hadoop104
do
echo "=======================启动$host zookeeper=================="
ssh $host "/opt/module/zookeeper/bin/zkServer.sh start"
done
;;
"stop")
for host in hadoop102 hadoop103 hadoop104
do
echo "=======================停止$host zookeeper=================="
ssh $host "/opt/module/zookeeper/bin/zkServer.sh stop"
done
;;
"status")
for host in hadoop102 hadoop103 hadoop104
do
echo "=======================$host zookeeper状态=================="
ssh $host "/opt/module/zookeeper/bin/zkServer.sh status"
done
;;
*)
echo "参数输入错误,必须是start/stop/status...."
;;
esac
05_zookeeper启动脚本
最新推荐文章于 2023-12-16 10:38:16 发布