zookeeper Client Session 0x0 for server null

本文记录了作者在虚拟机外部尝试调用单机模式下ZooKeeper服务时遇到的连接失败问题及解决过程。错误提示为连接超时,并最终定位到虚拟机防火墙导致的问题。关闭防火墙后,连接恢复正常。
昨天自己写程序来测试调用单机模式的zookeeper服务。服务的安装不说了,网上太多了。当我安装完毕,在虚拟机本地调用zkCli来调试,没有问题。但在虚拟机外调用,总是连接不上,报错:

[08-21 18:20:59 WARN ] org.apache.zookeeper.ClientCnxn$SendThread - 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(Unknown Source)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:286)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1041)
[08-21 18:20:59 DEBUG] org.apache.zookeeper.ClientCnxnSocketNIO - Ignoring exception during shutdown input

最后发现时虚拟机防火墙开着,关闭防火墙后则一切正常。
关闭防火墙命令:service iptables stop

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值