首页 > 解决方案 > __consumer_offsets 主题在使用 zookeeper 和 bootstrap-server 描述时显示不同的配置

问题描述

Kafka 版本 - 2.4.0 我正在使用kafka-topics.sh脚本来描述具有以下 2 个选项的__consumer_offsets主题

他们都显示了不同的复制因子和主题的配置..

任何人都可以在这里帮助理解为什么会出现这种行为。非常感谢您的帮助。

使用 --bootstrap-server 时

./kafka-topics.sh --bootstrap-server kafka-broker:9092 --describe --topic __consumer_offsets

Topic: __consumer_offsets       PartitionCount: 50      ReplicationFactor: 3    Configs: compression.type=producer,min.insync.replicas=1,cleanup.policy=compact,segment.bytes=104857600,retention.ms=60000,message.format.version=0.10.2-IV0,file.delete.delay.ms=30000,unclean.leader.election.enable=true,retention.bytes=132070253,delete.retention.ms=30000,segment.ms=3600000

使用 --zookeeper 时

./kafka-topics.sh --zookeeper zookeeper-host:2181/asrkafka --describe --topic __consumer_offsets

Topic: __consumer_offsets       PartitionCount: 50      ReplicationFactor: 3    Configs: compression.type=producer,cleanup.policy=compact,segment.bytes=104857600

标签: javaapache-kafkakafka-consumer-api

解决方案


非 Zookeeper 选项使用 AdminClient API,该 API 提取存储在代理设置中的附加主题元数据,而不仅仅是在 Zookeeper 中。


推荐阅读