Binary
Binary

Reputation: 81

Zookeeper stat command confusion

I have 3-node zookeeper cluster. 10.0.0.1, 10.0.0.2, 10.0.0.3. After starting running. 10.0.0.3 has been elected as Leader. When I try to get the status of the node with command stat, outputs like below:

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

Run the same command on 10.0.0.1 will output like

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

On 10.0.0.2, outputs like below:

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

I'm confused with the Clients block in both 3 outputs. Why did they look different? Is there anyone know what is the mechanism in Zookeeper stat to show the Clients block? Thanks

Upvotes: 0

Views: 868

Answers (1)

tk421
tk421

Reputation: 5957

The Clients block is just showing the client connections. When you connect to ZooKeeper, you don't connect to every server, you can connect to any server. So to interpret your stat output:

  • The leader at 10.0.0.3 has 3 client connections
  • follower 1 at 10.0.0.1 has 2 connections
  • follower 2 at 10.0.0.2 has 1 connection

For reference you can look at StatCommand.java.

Upvotes: 1

Related Questions