我试图用 2 个节点设置 zookeeper quorum 1st,然后用 3 个节点设置,但在这两种情况下我都遇到了同样的错误。
我已经尝试重新启动 zookeeper 节点,但没有帮助。
对于 ist 节点 zookeeper.out 显示
binding to port 0.0.0.0/0.0.0.0:2181
2019-12-13 14:19:33,893 [myid:1] - INFO [main:QuorumPeer@1158] - tickTime set to 2000
2019-12-13 14:19:33,893 [myid:1] - INFO [main:QuorumPeer@1204] - initLimit set to 10
2019-12-13 14:19:33,893 [myid:1] - INFO [main:QuorumPeer@1178] - minSessionTimeout set to -1
2019-12-13 14:19:33,893 [myid:1] - INFO [main:QuorumPeer@1189] - maxSessionTimeout set to -1
2019-12-13 14:19:33,899 [myid:1] - INFO [main:QuorumPeer@1467] - QuorumPeer communication is not secured!
2019-12-13 14:19:33,901 [myid:1] - INFO [main:QuorumPeer@1496] - quorum.cnxn.threads.size set to 20
2019-12-13 14:19:33,903 [myid:1] - INFO [main:QuorumPeer@668] - currentEpoch not found! Creating with a reasonable default of 0. This should only happen when you are upgrading your installation
2019-12-13 14:19:34,010 [myid:1] - INFO [main:QuorumPeer@683] - acceptedEpoch not found! Creating with a reasonable default of 0. This should only happen when you are upgrading your installation
2019-12-13 14:19:34,055 [myid:1] - INFO [ListenerThread:QuorumCnxManager$Listener@736] - My election bind port: /10.10.87.180:3888
2019-12-13 14:19:34,062 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer@909] - LOOKING
2019-12-13 14:19:34,063 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@813] - New election. My id = 1, proposed zxid=0x0
2019-12-13 14:19:34,065 [myid:1] - INFO [WorkerReceiver[myid=1]:FastLeaderElection@595] - Notification: 1 (message format version), 1 (n.leader), 0x0 (n.zxid), 0x1 (n.round), LOOKING (n.state), 1 (n.sid), 0x0 (n.peerEpoch) LOOKING (my state)
2019-12-13 14:19:34,070 [myid:1] - WARN [WorkerSender[myid=1]:QuorumCnxManager@584] - Cannot open channel to 2 at election address /10.10.87.241:3888
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
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:748)
对于第二个节点 zookeeper.out 说
Resolved hostname: 10.10.87.180 to address: /10.10.87.180
2019-12-13 14:45:09,565 [myid:2] - INFO [QuorumPeer[myid=2]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@847] - Notification time out: 60000
2019-12-13 14:46:12,564 [myid:2] - WARN [QuorumPeer[myid=2]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@584] - Cannot open channel to 1 at election address /10.10.87.180:3888
java.net.NoRouteToHostException: No route to host (Host unreachable)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:558)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:610)
at org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:838)
at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:957)