zookeeper client on windows cannot connect to the server on the linux

异常:

2014-02-16 22:07:19,284 [myid:] - WARN  [main-SendThread(192.168.177.128:2181):ClientCnxn$SendThread@1089] - 
Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection timed out: no further information
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
        at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1468)
        at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1496)
        at org.apache.zookeeper.ZooKeeperMain.processZKCmd(ZooKeeperMain.java:725)
        at org.apache.zookeeper.ZooKeeperMain.processCmd(ZooKeeperMain.java:593)
        at org.apache.zookeeper.ZooKeeperMain.executeLine(ZooKeeperMain.java:365)
        at org.apache.zookeeper.ZooKeeperMain.run(ZooKeeperMain.java:323)
        at org.apache.zookeeper.ZooKeeperMain.main(ZooKeeperMain.java:282)

   

     windows上可以ping通linux server,但是zookeeper 客户端始终连接不上,最终查找到原因是 linux启用了防火墙。

    关闭防火墙:

    

service iptables stop  (不需要重启,但是重启后失效)

 
 

你可能感兴趣的:(zookeeper)