依次关掉服务
当前状态
代码语言:javascript复制[root@h101 zk]# zookeeper-3.4.6/bin/zkServer.sh status
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
[root@h101 zk]# zookeeper-3.4.6.1/bin/zkServer.sh status
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6.1/bin/../conf/zoo.cfg
Mode: leader
[root@h101 zk]# zookeeper-3.4.6.2/bin/zkServer.sh status
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6.2/bin/../conf/zoo.cfg
Mode: follower
[root@h101 zk]#
关掉当前leader
代码语言:javascript复制[root@h101 zk]# zookeeper-3.4.6.1/bin/zkServer.sh stop
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6.1/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
[root@h101 zk]# zookeeper-3.4.6.2/bin/zkServer.sh status
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6.2/bin/../conf/zoo.cfg
Mode: leader
[root@h101 zk]# zookeeper-3.4.6/bin/zkServer.sh status
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
[root@h101 zk]#
关掉新选出的leader(关掉一大半server)
代码语言:javascript复制[root@h101 zk]# zookeeper-3.4.6.2/bin/zkServer.sh stop
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6.2/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
[root@h101 zk]# zookeeper-3.4.6/bin/zkServer.sh status
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
[root@h101 zk]# zookeeper-3.4.6.1/bin/zkServer.sh status
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6.1/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
[root@h101 zk]# zookeeper-3.4.6.2/bin/zkServer.sh status
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6.2/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
[root@h101 zk]# ps faux | grep zookeeper | grep -v grep
root 6117 0.9 2.4 2103548 46112 pts/0 Sl 20:27 0:01 java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /root/zk/zookeeper-3.4.6/bin/../build/classes:/root/zk/zookeeper-3.4.6/bin/../build/lib/*.jar:/root/zk/zookeeper-3.4.6/bin/../lib/slf4j-log4j12-1.6.1.jar:/root/zk/zookeeper-3.4.6/bin/../lib/slf4j-api-1.6.1.jar:/root/zk/zookeeper-3.4.6/bin/../lib/netty-3.7.0.Final.jar:/root/zk/zookeeper-3.4.6/bin/../lib/log4j-1.2.16.jar:/root/zk/zookeeper-3.4.6/bin/../lib/jline-0.9.94.jar:/root/zk/zookeeper-3.4.6/bin/../zookeeper-3.4.6.jar:/root/zk/zookeeper-3.4.6/bin/../src/java/lib/*.jar:/root/zk/zookeeper-3.4.6/bin/../conf: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /root/zk/zookeeper-3.4.6/bin/../conf/zoo.cfg
[root@h101 zk]# zookeeper-3.4.6/bin/zkServer.sh status
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
[root@h101 zk]#