Kafka describe cmd always return 至少一个活动分区
Kafka describe cmd always return at least one alive partition
我刚刚开始学习kafka,我正在关注文档的介绍部分。
据我了解,命令“describe”应该表明有多少个分区的副本在集群中处于活动状态并且运行良好。来自文档
"isr" is the set of "in-sync" replicas. This is the subset of the
replicas list that is currently alive and caught-up to the leader.
但是在关闭我的所有节点后(zookeeper 仍然 运行)和 运行 描述:
$ bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test-replicated
我得到以下结果:似乎表明 nbroker 2 有一个分区正常运行?
Topic:test-replicated PartitionCount:1 ReplicationFactor:3 Configs:
Topic: test-replicated Partition: 0 Leader: 2 Replicas: 1,2,0 Isr: 2
有人可以向我解释为什么吗?也许我对 kafka 有什么误解?
编辑
刚刚注意到,在仅重新启动我的节点后 0
,同一命令的输出现在表明代理“0”是一个分区的所有者,该分区处于活动状态并且正在工作。这是否意味着当没有节点处于活动状态时,显示的代理是所有节点关闭之前 运行 的最后一个代理?
Topic:test-replicated PartitionCount:1 ReplicationFactor:3 Configs:
Topic: test-replicated Partition: 0 Leader: 0 Replicas: 1,2,0 Isr: 0
主题详细信息的数据来自 Zookeeper,因此不需要连接到 Kafka 代理。特定分区的信息通常存储在 znode (/brokers/topics/topicname/partitions/partition-number) 中。它们由 Kafka 集群中的控制器更新。通常,最先启动的 Kafka 服务器成为控制器(直到它宕机或与 Zookeeper 失去联系)。当您关闭 Kafka 集群时,所有主题详细信息仍将保留在 Zookeeper 中,并且不会被任何人更新,因为控制器节点也已关闭。因此,您将继续从 kafka-topics.sh 命令中看到 "stale" 主题分区详细信息。
一旦服务器再次启动,它就会成为控制器,它会检测哪些节点是 up 的,哪些是 down 的,它会更新 zookeeper 中的信息。
我刚刚开始学习kafka,我正在关注文档的介绍部分。 据我了解,命令“describe”应该表明有多少个分区的副本在集群中处于活动状态并且运行良好。来自文档
"isr" is the set of "in-sync" replicas. This is the subset of the replicas list that is currently alive and caught-up to the leader.
但是在关闭我的所有节点后(zookeeper 仍然 运行)和 运行 描述:
$ bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test-replicated
我得到以下结果:似乎表明 nbroker 2 有一个分区正常运行?
Topic:test-replicated PartitionCount:1 ReplicationFactor:3 Configs:
Topic: test-replicated Partition: 0 Leader: 2 Replicas: 1,2,0 Isr: 2
有人可以向我解释为什么吗?也许我对 kafka 有什么误解?
编辑
刚刚注意到,在仅重新启动我的节点后 0
,同一命令的输出现在表明代理“0”是一个分区的所有者,该分区处于活动状态并且正在工作。这是否意味着当没有节点处于活动状态时,显示的代理是所有节点关闭之前 运行 的最后一个代理?
Topic:test-replicated PartitionCount:1 ReplicationFactor:3 Configs:
Topic: test-replicated Partition: 0 Leader: 0 Replicas: 1,2,0 Isr: 0
主题详细信息的数据来自 Zookeeper,因此不需要连接到 Kafka 代理。特定分区的信息通常存储在 znode (/brokers/topics/topicname/partitions/partition-number) 中。它们由 Kafka 集群中的控制器更新。通常,最先启动的 Kafka 服务器成为控制器(直到它宕机或与 Zookeeper 失去联系)。当您关闭 Kafka 集群时,所有主题详细信息仍将保留在 Zookeeper 中,并且不会被任何人更新,因为控制器节点也已关闭。因此,您将继续从 kafka-topics.sh 命令中看到 "stale" 主题分区详细信息。 一旦服务器再次启动,它就会成为控制器,它会检测哪些节点是 up 的,哪些是 down 的,它会更新 zookeeper 中的信息。