JAVA之搭建zookeeper集群时候遇到的问题

问题1.如果在搭建集群时碰到类似于这样的错误, Cannot open channel to 2 at election address

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

描述:这样的问题是你在配置集群地址的时候,他无法同时启动其他服务

解决:

本机用节点 用  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

上一篇:mysql & java & spring transaction isolation level


下一篇:我的Spring Boot学习记录(二):Tomcat Server以及Spring MVC的上下文问题