@zookeeper batch startup script
#! /bin/bash
node='master slave1 slave2'
zkServerPath="/opt/zookeeper-3.4.10/bin/zkServer.sh"
case $1 in
"start"){
for i in $node
do
ssh $i "$zkServerPath start"
done
};;
"stop"){
for i in $node
do
ssh $i "$zkServerPath stop"
done
};;
"status"){
for i in $node
do
ssh $i "$zkServerPath status"
done
};;
esac
Remarks: The premise is that the machines can log in without secret, write the parameter start/stop/status after the script name when starting