注意目录替换
#!/bin/bash
#参数传递
usage="Usage: $0 (start|stop|status)"
if [ $# -lt 1 ]; then
echo $usage
exit 1
fi
behave=$1
echo "$behave zkServer cluster"
#主机名称
for i in 01 02 03
do
#使用ssh进行启动
ssh zk$i "apps/apache-zookeeper-3.6.0-bin/bin/zkServer.sh $behave"
done
exit 0