ZooKeeper节点计数器?

时间:2017-03-31 19:21:38

标签: apache-zookeeper

我有一个只有2个节点的ZooKeeper集群,每个zoo.conf都有以下

# Servers
server.1=10.138.0.8:2888:3888
server.2=10.138.0.9:2888:3888

两者配置

中存在相同的两行
[root@zk1-prod supervisor.d]# echo mntr | nc  10.138.0.8 2181
zk_version      3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
zk_avg_latency  0
zk_max_latency  0
zk_min_latency  0
zk_packets_received     5
zk_packets_sent 4
zk_num_alive_connections        1
zk_outstanding_requests 0
zk_server_state follower
zk_znode_count  4
zk_watch_count  0
zk_ephemerals_count     0
zk_approximate_data_size        27
zk_open_file_descriptor_count   28
zk_max_file_descriptor_count    4096

[root@zk1-prod supervisor.d]# echo mntr | nc  10.138.0.9 2181
zk_version      3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
zk_avg_latency  0
zk_max_latency  0
zk_min_latency  0
zk_packets_received     3
zk_packets_sent 2
zk_num_alive_connections        1
zk_outstanding_requests 0
zk_server_state leader
zk_znode_count  4
zk_watch_count  0
zk_ephemerals_count     0
zk_approximate_data_size        27
zk_open_file_descriptor_count   29
zk_max_file_descriptor_count    4096
zk_followers    1
zk_synced_followers     1
zk_pending_syncs        0

为什么 zk_znode_count == 4?

1 个答案:

答案 0 :(得分:2)

Znodes不是Zookeeper服务器。

来自 Hadoop权威指南

  

Zookeeper没有文件和目录,而是统一的概念   一个名为znode的节点,它既可以作为数据的容器(如a   文件)和其他znode的容器(如目录)。

zk_znode_count是指该Zookeeper服务器中可用的znode数。在您的ZK集合中,每个服务器都有四个znode。