wangqingbo0829
菲力蒲LY
采纳率50%
2016-09-26 02:05

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

20

我用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条回答

  • wangqingbo0829 菲力蒲LY 5年前

    问题的资料补充——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
    
    点赞 评论 复制链接分享
  • u011606457 _1_1_7_ 5年前

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

    比如:
    集群机器配置:

    server1=ip1:2888:3888;

    server2=ip2:2888:3888;

    server3=ip3:2888:3888;

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

    点赞 评论 复制链接分享
  • wangqingbo0829 菲力蒲LY 5年前

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

    点赞 评论 复制链接分享
  • feng1790291543 鱼弦 5年前