Zookeeper stat命令混乱

时间:2019-05-09 06:43:19

标签: apache-kafka apache-zookeeper

我有3节点的Zookeeper集群。 10.0.0.110.0.0.210.0.0.3。开始运行后。 10.0.0.3被选为领导人。当我尝试使用命令stat获取节点的状态时,输出如下:

Zookeeper version: 3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03, built on 06/29/2018 00:39 GMT
Clients:
 /127.0.0.1:60380[0](queued=0,recved=1,sent=0)
 /10.0.0.3:60292[1](queued=0,recved=44074,sent=44131)
 /10.0.0.1:51500[1](queued=0,recved=6287950,sent=6288007)

Latency min/avg/max: 0/0/45
Received: 7595959
Sent: 7596074
Connections: 3
Outstanding: 0
Zxid: 0xd000013a9
Mode: leader
Node count: 1712
Proposal sizes last/min/max: 32/32/5109

10.0.0.1上运行相同的命令将输出类似

Zookeeper version: 3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03, built on 06/29/2018 00:39 GMT
Clients:
 /10.0.0.3:47832[0](queued=0,recved=1,sent=0)
 /10.0.0.1:54326[1](queued=0,recved=6664230,sent=6664344)

Latency min/avg/max: 0/0/31
Received: 13802470
Sent: 13802583
Connections: 2
Outstanding: 0
Zxid: 0xd000013a9
Mode: follower
Node count: 1712

10.0.0.2上,输出如下:

Zookeeper version: 3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03, built on 06/29/2018 00:39 GMT
Clients:
 /10.0.0.3:47766[0](queued=0,recved=1,sent=0)

Latency min/avg/max: 0/0/8
Received: 1058
Sent: 1057
Connections: 1
Outstanding: 0
Zxid: 0xd000013a9
Mode: follower
Node count: 1712

我对3个输出中的Clients块都感到困惑。为什么它们看起来不同?有谁知道Zookeeper stat中显示Clients块的机制是什么?谢谢

1 个答案:

答案 0 :(得分:0)

Clients块仅显示客户端连接。当您连接到ZooKeeper时,您并没有连接到每台服务器,而是可以连接到任何服务器。因此,请解释您的stat输出:

  • 10.0.0.3的负责人具有3个客户端连接
  • 10.0.0.1的从属1具有2个连接
  • 10.0.0.2上的从属2具有1个连接

作为参考,您可以查看StatCommand.java