Zookeeper搭建集群问题
错误日志:ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper-3.4.14/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
解决方案:
1.注意myid文件内容是否对应zk集群配置的server.id
2.注意Server的防火墙是否开放zk端口
错误日志:
2020-02-18 14:36:53,275 [myid:0] - INFO [QuorumPeer[myid=0]/0.0.0.0:2181:FastLeaderElection@847] - Notification time out: 12800
2020-02-18 14:37:06,076 [myid:0] - INFO [QuorumPeer[myid=0]/0.0.0.0:2181:QuorumCnxManager@347] - Have smaller server identifier, so dropping the connection: (1, 0)
2020-02-18 14:37:06,077 [myid:0] - INFO [QuorumPeer[myid=0]/0.0.0.0:2181:QuorumCnxManager@347] - Have smaller server identifier, so dropping the connection: (2, 0)
2020-02-18 14:37:06,077 [myid:0] - INFO [QuorumPeer[myid=0]/0.0.0.0:2181:FastLeaderElection@847] - Notification time out: 25600
2020-02-18 14:37:31,678 [myid:0] - INFO [QuorumPeer[myid=0]/0.0.0.0:2181:QuorumCnxManager@347] - Have smaller server identifier, so dropping the connection: (1, 0)
2020-02-18 14:37:31,679 [myid:0] - INFO [QuorumPeer[myid=0]/0.0.0.0:2181:QuorumCnxManager@347] - Have smaller server identifier, so dropping the connection: (2, 0)
2020-02-18 14:37:31,680 [myid:0] - INFO [QuorumPeer[myid=0]/0.0.0.0:2181:FastLeaderElection@847] - Notification time out: 51200
解决方案: 保持这台有问题zk的现状, 按myid从小到大依次重启其他的zk机器;
原因: zk是需要集群中所有机器两两建立连接的, 其中配置中的3555端口是用来进行选举时机器直接建立通讯的端口, 大id的server才会去连接小id的server,避免连接浪费.如果是最后重启myid最小的实例,该实例将不能加入到集群中, 因为不能和其他集群建立连接