2 wangqingbo0829 wangqingbo0829 于 2016.09.26 10:05 提问

zookeeper集群,宕掉1个后,都不能用了 20C

我用VMWare搭建了3个主机的zookeeper,已经实现了数据同步了(在一个主机创建了数据,在其他主机,启动客户端,都能查看了)。但,其中一个kill -9 id后,其他的都不能用了。

 [root@wqb99 ~]# /itcast/zookeeper-3.4.9/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /itcast/zookeeper-3.4.9/bin/../conf/zoo.cfg
Mode: leader
[root@wqb99 ~]# jps
2739 Jps
2531 QuorumPeerMain
[root@wqb99 ~]# kill -9 2531
[root@wqb99 ~]# jps
2749 Jps
[root@wqb99 ~]# 

发现其他节点也宕机了
(1)
[root@wqb88 ~]# /itcast/zookeeper-3.4.9/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /itcast/zookeeper-3.4.9/bin/../conf/zoo.cfg
Mode: follower
[root@wqb88 ~]# /itcast/zookeeper-3.4.9/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /itcast/zookeeper-3.4.9/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
[root@wqb88 ~]#
(2)
[root@wqb66 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /itcast/zookeeper-3.4.9/bin/../conf/zoo.cfg
Mode: follower
[root@wqb66 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /itcast/zookeeper-3.4.9/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
[root@wqb66 bin]#

4个回答

feng1790291543
feng1790291543   Ds   Rxr 2016.09.26 10:25
wangqingbo0829
wangqingbo0829 感谢您的帮忙,我认真阅读了您推荐的这两篇博文,我没有找到有效的解决方案。请大神再帮忙分析分析
大约一年之前 回复
wangqingbo0829
wangqingbo0829   2016.09.26 10:56

感谢您的帮忙,我认真阅读了您推荐的这两篇博文,我没有找到有效的解决方案。请大神再帮忙分析分析

u011606457
u011606457   2016.09.26 11:41

集群中每个机器都需要感知其他机器的存在

比如:
集群机器配置:

server1=ip1:2888:3888;

server2=ip2:2888:3888;

server3=ip3:2888:3888;

2888是follow连接leader的端口号,3888是选举leader的端口号

wangqingbo0829
wangqingbo0829 感谢,这个配了,已实现了数据同步。我把配置文件一块儿贴出来吧
大约一年之前 回复
wangqingbo0829
wangqingbo0829   2016.09.26 14:29

问题的资料补充——zoo.cfg配置文件:

 [root@wqb66 conf]# cat zoo.cfg 
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/itcast/zookeeper-3.4.9/data
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1


server.1=wqb88:2888:3888
server.2=wqb99:2888:3888
server.3=wqb66:2888:3888
Csdn user default icon
上传中...
上传图片
插入图片