[异常笔记] zookeeper集群启动异常: Cannot open channel to 2 at election address ……
4-11 13:22:04,594 [myid:1] - WARN [WorkerSender[myid=1]:QuorumCnxManager@584] - Cannot open channel to 2 at election address cdh03/192.168.5.148: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) 4-11 13:22:04,597 [myid:1] - INFO [WorkerSender[myid=1]:QuorumPeer$QuorumServer@184] - Resolved hostname: cdh03 to address: cdh03/192.168.5.148 4-11 13:22:04,598 [myid:1] - WARN [WorkerSender[myid=1]:QuorumCnxManager@584] - Cannot open channel to 3 at election address cdh04/192.168.5.149: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) 4-11 13:22:04,599 [myid:1] - INFO [WorkerSender[myid=1]:QuorumPeer$QuorumServer@184] - Resolved hostname: cdh04 to address: cdh04/192.168.5.149 4-11 13:22:04,807 [myid:1] - WARN [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@584] - Cannot open channel to 2 at election address cdh03/192.168.5.148:3888 java.net.ConnectException: Connection refused (Connection refused)
解决方法:本机用节点 用 0.0.0.0 IP代替主机名
[hadoop@cdh02 ~]$ cat /opt/software/zookeeper-3.4.13/conf/zoo.cfg server.1=0.0.0.0:2888:3888 server.2=cdh03:2888:3888 server.3=cdh04:2888:3888 [hadoop@cdh03 ~]$ cat /opt/software/zookeeper-3.4.13/conf/zoo.cfg server.1=cdh02:2888:3888 server.2=0.0.0.0:2888:3888 server.3=cdh04:2888:3888 [hadoop@cdh04 ~]$ cat /opt/software/zookeeper-3.4.13/conf/zoo.cfg server.1=cdh02:2888:3888 server.2=cdh03:2888:3888 server.3=0.0.0.0:2888:3888