首页 > 代码库 > zookeeper报Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect的解决

zookeeper报Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect的解决

现象

服务器连不上,kafka报connection refused

测试发现kafka某台node(xx)的问题,登录上去也各种错误,zkServer.sh restart可以完成,但status报连不上。报错比较迷惑人,打开java log看到其他错误:

[myid:3] - INFO  [ListenerThread:QuorumCnxManager$Listener@534] - My election bind port: /yy:3888

java.net.BindException: Cannot assign requested address

...

[myid:3] - WARN  [WorkerSender[myid=3]:QuorumCnxManager@400] - Cannot open channel to 1 at election address /xx:3888

java.net.ConnectException: Connection refused

其实这个错误可以看出来,出现了xx和yy2个地址,说明它认错了自己

解决方案

从zoo.cfg看下datadir,将下面的myid改成和zoo.cfg里的自己一样的。比如xx是

server.1=xx:2888:3888
server.2=yy:2888:3888
server.3=zz:2888:3888

那么它的myid必须是1

zookeeper报Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect的解决