简体   繁体   中英

Zookeeper connection exception, connection refused

 ERROR NetworkManager client connect error
java.net.ConnectException: Connection refused
        at sun.nio.ch.Net.connect0(Native Method)
        at sun.nio.ch.Net.connect(Net.java:458)
        at sun.nio.ch.Net.connect(Net.java:450)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
        at ch.usi.da.paxos.ring.NetworkManager.connectClient(NetworkManager.java         :295)
        at ch.usi.da.paxos.ring.RingManager.notifyRingChanged(RingManager.java:115)
        at ch.usi.da.paxos.ring.RingManager.process(RingManager.java:189)
        at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.j         ava:522)
        at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:498)

Is the error I receive when calling Zookeeper from a Java client.

My zookeeper configuration is

tickTime=2000
dataDir=/var/lib/zookeeper/
clientPort=2181
initLimit=5
syncLimit=2
server.1=192.168.1.200:2888:3888                                
server.2=192.168.1.201:2888:3888
server.3=192.168.1.202:2888:3888

I'm running the programm on Linux, on windows with a single zookeeper instance everything worked excellent. It seems like Zookeeper client connected to a different subnet than the server.

Problem resolved. The client first chose the ipv6 interface, while the server was configured for ipv4. After that the Client chose the global Ip of the computer, while the server was configured for the local ip.

Disabling ipv6 on the cluster and configuring the server to the global ip did the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM