關於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臺及以上就可以連接了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章