黑猴子的家:zk.sh

#!/bin/bash

user=`whoami`
zookeeper_home='/opt/module/zookeeper-3.5.9'

echo -e "================    正在启动Zookeeper      ==========="
case $1 in
    start | stop | status)
        for((host=102; host<=104; host++)); do
            echo -e "\n---${user}@hadoop${host}---"
            ssh ${user}@hadoop${host} "${zookeeper_home}/bin/zkServer.sh $1"
        done
    ;;
    *)
        echo "你启动的姿势不对"
        echo "  start   启动zookeeper集群"
        echo "  stop    停止zookeeper集群"
        echo "  status  查看zookeeper集群"
    ;;
esac

你可能感兴趣的:(黑猴子的家:zk.sh)