一键启动三个节点(hadoop11,hadoop12,hadoop13)zookeeper
bash
#! /bin/bash
if [ $# -eq 0 ]
then
echo '没有提供参数 start | stop | status'
exit
fi
function start(){
for i in 11 12 13
do
echo --------------- hadoop$i -----------
ssh root@hadoop$i "source /etc/profile;zkServer.sh start"
done
}
function stop(){
for i in 11 12 13
do
echo --------------- hadoop$i -----------
ssh root@hadoop$i "source /etc/profile;zkServer.sh stop"
done
}
function status(){
for i in 11 12 13
do
echo --------------- hadoop$i -----------
ssh root@hadoop$i "source /etc/profile;zkServer.sh status"
done
}
if [ "$1" = "start" ]; then
start
elif [ "$1" = "stop" ]; then
stop
elif [ "$1" = "status" ]; then
status
else
echo "Usage: $0 [start|stop|status]"
exit 1
fi