黑猴子的家:zk-stop.sh

在/usr/local/bin 目录下

[alex@hadoop102 ~]$ cd /usr/local/bin/
[alex@hadoop102 bin]$ sudo touch zk-stop.sh
[alex@hadoop102 bin]$ sudo chown alex:alex zk-stop.sh
[alex@hadoop102 bin]$ chmod 755 zk-stop.sh
[alex@hadoop102 bin]$ vim zk-stop.sh
#!/bin/bash

user=`whoami`

echo -e "================    正在启动Zookeeper      ===========\n"
for((host=102; host<=104; host++)); do
    echo -e "\n---$user@hadoop$host---"
    ssh $user@hadoop$host '/opt/module/zookeeper-3.4.10/bin/zkServer.sh stop'
done

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