搭建zookeeper集群的时候3个节点,配置明明正确,却总是由一个启动不了,找了半天原因也没有找到。
错误信息如下
2017-11-26 10:35:56,341 [myid:3] - INFO [WorkerReceiver[myid=3]:FastLeaderElection@602] - Notification: 1 (message format version), 1 (n.leader), 0x100000000 (n.zxid), 0x1 (n.round), LEADING (n.state), 1 (n.sid), 0x4 (n.peerEpoch) LOOKING (my state)
2017-11-26 10:35:56,343 [myid:3] - INFO [WorkerSender[myid=3]:QuorumPeer$QuorumServer@184] - Resolved hostname: hadoop-senior02.ibeifeng.com to address: hadoop-senior02.ibeifeng.com/192.168.129.129
2017-11-26 10:35:56,344 [myid:3] - INFO [WorkerReceiver[myid=3]:FastLeaderElection@602] - Notification: 1 (message format version), 3 (n.leader), 0x100000000 (n.zxid), 0x1 (n.round), LOOKING (n.state), 3 (n.sid), 0x3 (n.peerEpoch) LOOKING (my state)
2017-11-26 10:35:57,642 [myid:3] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /127.0.0.1:56090
2017-11-26 10:35:57,646 [myid:3] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ServerCnxn@324] - The list of known four letter word commands is : [{2003003491=wchc, 1668247155=cons, 1668445044=crst, 1735683435=gtmk, 1936881266=srvr, 1835955314=mntr, 2003003504=wchp
, 1668247142=conf, 1937010027=stmk, 2003003507=wchs, 1769173615=isro, 1936880500=srst, 1920298859=ruok, 1937006964=stat, 1701738089=envi, 1685417328=dump}]
2017-11-26 10:35:57,646 [myid:3] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ServerCnxn@325] - The list of enabled four letter word commands is : [[wchs, srst, dump, gtmk, crst, envi, stmk, mntr, isro, conf, ruok, stat, srvr, cons]]
2017-11-26 10:35:57,646 [myid:3] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@892] - Processing srvr command from /127.0.0.1:56090
2017-11-26 10:35:57,647 [myid:3] - INFO [Thread-1:NIOServerCnxn@1040] - Closed socket connection for client /127.0.0.1:56090 (no session established for client)
2017-11-26 10:35:59,405 [myid:3] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /127.0.0.1:56091
2017-11-26 10:35:59,416 [myid:3] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@892] - Processing srvr command from /127.0.0.1:56091
2017-11-26 10:35:59,417 [myid:3] - INFO [Thread-2:NIOServerCnxn@1040] - Closed socket connection for client /127.0.0.1:56091 (no session established for client)
2017-11-26 10:35:59,545 [myid:3] - INFO [QuorumPeer[myid=3]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@854] - Notification time out: 6400
2017-11-26 10:35:59,547 [myid:3] - WARN [WorkerSender[myid=3]:QuorumCnxManager@584] - Cannot open channel to 2 at election address hadoop-senior02.ibeifeng.com/192.168.129.129:3888
java.net.ConnectException: Connection refusedat java.net.PlainSocketImpl.socketConnect(Native Method)at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)at java.net.Socket.connect(Socket.java:579)at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:558)at org.apache.zookeeper.server.quorum.QuorumCnxManager.toSend(QuorumCnxManager.java:534)at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.process(FastLeaderElection.java:454)at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.run(FastLeaderElection.java:435)at java.lang.Thread.run(Thread.java:745)
最后参照stackoverflow 解决方法如下
server1 配置如下
server.1=0.0.0.0:2888:3888
server.2=hadoop-senior02.ibeifeng.com:2888:3888
server.3=hadoop-senior03.ibeifeng.com:2888:3888
server2 配置如下
server.1=hadoop-senior.ibeifeng.com:2888:3888
server.2=0.0.0.0:2888:3888
server.3=hadoop-senior03.ibeifeng.com:2888:3888
server3 配置如下
server.1=hadoop-senior.ibeifeng.com:2888:3888
server.2=hadoop-senior03.ibeifeng.com:2888:3888
server.3=0.0.0.0:2888:3888