Zookeeper的群起设置
1)在hadoop003的/root/bin目录下创建脚本
[root@hadoop003 ~]$ vim /root/bin/zk.sh
在脚本中编写如下内容,并更改为自己的机器名称
#! /bin/bash
case $1 in
#群开启
"start"){
for i
in hadoop003 hadoop004 hadoop005
do
ssh
$i "/opt/module/zookeeper-3.4.10/bin/zkServer.sh start"
done
};;
#群关闭
"stop"){
for i
in hadoop003 hadoop004 hadoop005
do
ssh
$i "/opt/module/zookeeper-3.4.10/bin/zkServer.sh stop"
done
};;
#群状态
"status"){
for i
in hadoop003 hadoop004 hadoop005
do
ssh
$i "/opt/module/zookeeper-3.4.10/bin/zkServer.sh status"
done
};;
esac
2)增加脚本执行权限
[root@hadoop003 bin]$ chmod 777 zk.sh
3)Zookeeper集群启动脚本(全局有效)
[root@hadoop003 module]$ zk.sh start
4)Zookeeper集群停止脚本(全局有效)
[root@hadoop003 module]$ zk.sh stop