HADOOP之 Zookeeper客户端登录时异常问题的处理(2)

HADOOP之 Zookeeper客户端登录时异常问题的处理

一 遇到的问题
1 建立好zookeeper 集群,分别为server1,server2,server3 ,在启动zookeeper 集群中一个节点的服务端后 ,直接启动当前节点 zkCli.sh (zookeeper客户端)的时候就出现了"进入客户端闪退" "日志信息无限重复打印"等异常,内容如下:

2020-08-26 19:43:15,498 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@852] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2020-08-26 19:43:15,498 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1098] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2020-08-26 19:43:17,077 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@975] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2020-08-26 19:43:17,078 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@852] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2020-08-26 19:43:17,078 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1098] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2020-08-26 19:43:17,823 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@975] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2020-08-26 19:43:17,823 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@852] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2020-08-26 19:43:17,824 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1098] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2020-08-26 19:43:19,633 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@975] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2020-08-26 19:43:19,634 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@852] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2020-08-26 19:43:19,635 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1098] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2020-08-26 19:43:20,715 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@975] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2020-08-26 19:43:20,715 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@852] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2020-08-26 19:43:20,716 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1098] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
............

二 问题解决
1 在网上查找原因,说是可能jar包版本与zookeeper版本不一致,然后去核对版本,发现版本号一致的情况下也无法注册服务。之后又去核对myid文件,发现也没有错误。
2 后面发现 ,由于在安装zookeeper软件时 ,在/opt/apps/zookeeper-3.4.6/conf /zoo.cfg 文件中配置了3台机器,如果只启动1台,zookeeper就会认为服务处于不可用状态。
3 zookeeper有个选举算法,当整个集群超过半数机器宕机,zookeeper会认为集群处于不可用状态。
4 所以,如果集群中有3台机器时 ,只启动其中的1台集群 ,zookeeper是无法连接的,即不能进入到客户端里面 ,当时如果启动2台及以上就可以连接到zookeeper客户端里面了。
5 总结 ,使用zookeeper集群时 ,需要同时启动集群中的每一台节点的 zookeeper服务端 (bin/zkServer.sh start) ,之后才启动连接到客户端 (bin/zkCli.sh ) ,这样的操作步骤顺序,才能使zookeeper正常运行 .

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值