#!/bin/bash
for i in mini1 mini2 mini3
do
ssh $i "source /etc/profile;/root/apps/zookeeper-3.5.5/bin/zkServer.sh $1"
done
启动zookeeper
[root@mini1 ~]# zkstart.sh start
start zkServer...
ZooKeeper JMX enabled by default
Using config: /root/apps/zookeeper-3.5.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
ZooKeeper JMX enabled by default
Using config: /root/apps/zookeeper-3.5.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
ZooKeeper JMX enabled by default
Using config: /root/apps/zookeeper-3.5.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
查看状态
[root@mini1 ~]# zkstart.sh status
start zkServer...
ZooKeeper JMX enabled by default
Using config: /root/apps/zookeeper-3.5.5/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower
ZooKeeper JMX enabled by default
Using config: /root/apps/zookeeper-3.5.5/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: leader
ZooKeeper JMX enabled by default
Using config: /root/apps/zookeeper-3.5.5/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower