导航菜单
路很长,又很短
博主信息
昵   称:Cocodroid ->关于我
Q     Q:2531075716
博文数:305
阅读量:707445
访问量:66811
至今:
×
云标签 标签球>>
云标签 - Su的技术博客
博文->>首页 博主的更多博文>>
ZK出现:zxid 0x609 our last zxid is 0x0 client must try another server
Tags : Zookeeper发表时间: 2017-11-06 21:09:33
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。
比如: 转自:Su的技术博客  原文地址:

    1、客户端连接ZK出现下面的异常信息


2017-11-02 15:36:42,489 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@873] - Refusing session request for client /127.0.0.1:49912 as it has seen zxid 0x2a1 our last zxid is 0x0 client must try another server
2017-11-02 15:36:42,489 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1008] - Closed socket connection for client /127.0.0.1:49912 (no session established for client)
2017-11-02 15:36:42,752 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /10.18.104.47:49915
2017-11-02 15:36:42,753 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@873] - Refusing session request for client /10.18.104.47:49915 as it has seen zxid 0x609 our last zxid is 0x0 client must try another server
2017-11-02 15:36:42,754 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1008] - Closed socket connection for client /10.18.104.47:49915 (no session established for client)
2017-11-02 15:36:44,324 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /10.18.104.47:49924
2017-11-02 15:36:44,325 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@873] - Refusing session request for client /10.18.104.47:49924 as it has seen zxid 0x609 our last zxid is 0x0 client must try another server
2017-11-02 15:36:44,325 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1008] - Closed socket connection for client /10.18.104.47:49924 (no session established for client)
2017-11-02 15:36:44,555 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /127.0.0.1:49926
2017-11-02 15:36:44,555 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@873] - Refusing session request for client /127.0.0.1:49926 as it has seen zxid 0x2a1 our last zxid is 0x0 client must try another server

    可以看出客户端一直在重连!使用连接不上。

    

    2、为什么会这样呢?

    那是因为我在重启ZK的时候,曾经删除过数据目录,这样造成zkid存在问题。客户端记录的是某个id,而服务端重启之后并且删除数据目录之后,id编号从0x0开始。

    Zookeeper的zxid会由于状态的变更主键递增1,为了保证事务的顺序一致性,zookeeper采用了递增的事务id号(zxid)来标识事务。这在选举的时候启动至关重要。

    所以一旦客户端的id比服务端大,服务端是拒绝连接的。



打赏
打赏
关注公众号
公众号
类别:大数据| 阅读(1812)| 赞 (1)
评论
#12018-06-14 18:01:20
ll [111.9.4 *] 说:
怎么解决的呢?

发表评论
昵  称:

验证码:

内  容:

    同时赞一个 赞