关于Unable to read additional data from server sessionid 0x0问题的解决。

今天搭建了一个zookeeper集群,分别为server1,server2,server3。

# The number of milliseconds of each tick

tickTime=2000

# The number of ticks that the initial 

# synchronization phase can take

initLimit=10

# The number of ticks that can pass between 

# sending a request and getting an acknowledgement

syncLimit=5

# the directory where the snapshot is stored.

dataDir=/tmp/zookeeper

# the port at which the clients will connect

clientPort=2181

server.1=172.16.1.159:2888:3888

server.2=172.16.1.123:2888:3888

server.3=172.16.1.22:2888:3888


在启动zkCli.sh 的时候就出现了日志信息无限重复打印,内容如下:

2017-10-23 10:57:14,816 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:15,036 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
2017-10-23 10:57:15,036 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2017-10-23 10:57:15,037 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:15,663 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/127.0.0.1:2181
2017-10-23 10:57:15,663 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2017-10-23 10:57:15,664 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:16,190 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
2017-10-23 10:57:16,190 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2017-10-23 10:57:16,191 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:16,358 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/127.0.0.1:2181
2017-10-23 10:57:16,359 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2017-10-23 10:57:16,359 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:16,773 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
2017-10-23 10:57:16,773 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2017-10-23 10:57:16,774 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:17,025 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/127.0.0.1:2181
2017-10-23 10:57:17,025 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2017-10-23 10:57:17,026 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:17,300 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
2017-10-23 10:57:17,300 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2017-10-23 10:57:17,301 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:18,229 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/127.0.0.1:2181
2017-10-23 10:57:18,230 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2017-10-23 10:57:18,231 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:18,747 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
2017-10-23 10:57:18,747 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2017-10-23 10:57:18,748 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:19,451 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/127.0.0.1:2181
2017-10-23 10:57:19,452 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2017-10-23 10:57:19,453 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:20,012 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
2017-10-23 10:57:20,012 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2017-10-23 10:57:20,013 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:20,947 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/127.0.0.1:2181
2017-10-23 10:57:20,947 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2017-10-23 10:57:20,948 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:21,907 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
2017-10-23 10:57:21,907 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2017-10-23 10:57:21,908 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:22,545 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/127.0.0.1:2181
2017-10-23 10:57:22,545 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2017-10-23 10:57:22,546 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:22,764 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
2017-10-23 10:57:22,765 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2017-10-23 10:57:22,765 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:23,370 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/127.0.0.1:2181
2017-10-23 10:57:23,371 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2017-10-23 10:57:23,372 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:24,093 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
2017-10-23 10:57:24,094 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2017-10-23 10:57:24,094 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2017-10-23 10:57:25,148 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/127.0.0.1:2181
2017-10-23 10:57:25,148 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established to localhost/127.0.0.1:2181, initiating session


使用dubbo添加服务的时候也添加不上,在网上查找原因,说是可能jar包版本与zookeeper版本不一致,然后去核对版本,发现版本号一致的情况下也无法注册服务。之后又去核对myid文件,发现也没有错误。

后来才搞明白,由于我在zoo.cfg中配置了3台机器,但是只启动了1台,zookeeper就会认为服务处于不可用状态。
zookeeper有个选举算法,当整个集群超过半数机器宕机,zookeeper会认为集群处于不可用状态。
所以,3台机器启动1台无法连接,如果启动2台及以上就可以连接了。

  • 17
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值