ZooKeeper只完美解决Unable to read additional data from server sessionid 0x0报错问题,并带你深度理解ZooKeeper内部机制之选举机制

ZooKeeper只完美解决Unable to read additional data from server sessionid 0x0报错问题,并带你深度理解ZooKeeper内部机制之选举机制

🍅 作者简介:上火不找我,CSDN2022新星计划top4🏆、算法领域新星创造者💪
🍅有什么问题直接私信作者,秒回哦💪💪💪


一、问题描述

Linux环境下

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

在这里插入图片描述

报错如下:

2022-08-08 22:10:44,294 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1240] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2022-08-08 22:10:45,716 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1112] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2022-08-08 22:10:45,717 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@959] - Socket connection established, initiating session, client: /0:0:0:0:0:0:0:1:41288, server: localhost/0:0:0:0:0:0:0:1:2181
2022-08-08 22:10:45,718 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1240] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2022-08-08 22:10:47,382 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1112] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2022-08-08 22:10:47,383 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@959] - Socket connection established, initiating session, client: /0:0:0:0:0:0:0:1:41290, server: localhost/0:0:0:0:0:0:0:1:2181
2022-08-08 22:10:47,384 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1240] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2022-08-08 22:10:48,849 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1112] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2022-08-08 22:10:48,850 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@959] - Socket connection established, initiating session, client: /127.0.0.1:39428, server: localhost/127.0.0.1:2181
2022-08-08 22:10:48,852 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1240] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2022-08-08 22:10:50,397 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1112] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2022-08-08 22:10:50,398 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@959] - Socket connection established, initiating session, client: /0:0:0:0:0:0:0:1:41294, server: localhost/0:0:0:0:0:0:0:1:2181
2022-08-08 22:10:50,399 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1240] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2022-08-08 22:10:52,214 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1112] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2022-08-08 22:10:52,215 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@959] - Socket connection established, initiating session, client: /127.0.0.1:39432, server: localhost/127.0.0.1:2181
2022-08-08 22:10:52,217 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1240] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2022-08-08 22:10:54,073 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1112] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2022-08-08 22:10:54,074 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@959] - Socket connection established, initiating session, client: /0:0:0:0:0:0:0:1:41298, server: localhost/0:0:0:0:0:0:0:1:2181
2022-08-08 22:10:54,077 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1240] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2022-08-08 22:10:55,613 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1112] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2022-08-08 22:10:55,614 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@959] - Socket connection established, initiating session, client: /127.0.0.1:39436, server: localhost/127.0.0.1:2181

在一个节点上进入到zookeeper命令行执行zkCli.sh 时,报了下面这个异常!

在这里插入图片描述


二、原因分析

一开始我以为配置文件的错误,但是经过检查后发现并不是这里的问题,所以我开始思考zookeeper的搭建机制

例如:半数机制:集群中半数以上机器存活,集群可用。所以Zookeeper适合安装奇数台服务器。


三、解决方案

例如你一次性启动了三台服务器,并且都使用zookeeper进行调度的话,就至少需要启动两台的zookeeper

那么你只需要再启动一台机器的zookeeper,多按几下回车刷新就可以了

在这里插入图片描述

🍅 作者简介:上火不找我,CSDN2022新星计划top4🏆、算法领域新星创造者💪
🍅有什么问题直接私信作者,秒回哦💪💪💪

🍅有帮助的记得给个三连支持一下,谢谢~~~💪💪💪

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

上火不找我

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值