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看到其他错误:

——————————

kafka complains connection refused. check it's a node's problem, even restart cannot fix. see java log below:

[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个地址,说明它认错了自己

——————————

the cause is setting config wrong  

解决方案

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

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

那么它的myid必须是1

————————————

the right way is to make myid's id same with zoo.cfg's

posted @ 2017-05-19 16:15  Els0n  阅读(33742)  评论(0编辑  收藏  举报