发现剩下一台,但服务已经不可用了
随便启动一台
代码语言: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
Error contacting service. It is probably not running.
[root@h101 zk]# zookeeper-3.4.6.1/bin/zkServer.sh start
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6.1/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[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: follower
[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: leader
[root@h101 zk]#
剩下的那个成为了leader,新启动的成为了follower,服务变得可用
集群模式
集群模式在配置上与之前的没有本质区别,唯一区别就是server分布在了不同的物理服务器上
修改配置
代码语言:javascript复制[root@h101 zk]# cat zookeeper-3.4.6-real/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/tmp/zookeeper101
dataLogDir=/tmp/zookeeper101
clientPort=2180
server.101=192.168.100.101:8000:8100
server.102=192.168.100.102:8000:8100
server.202=192.168.100.202:8000:8100
[root@h101 zk]#