__consumer_offsets主题,在与zookeeper和bootstrap-server描述时显示不同的配置

问题描述

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

  • -引导服务器
  • -zookeeper(已弃用)

它们两个都显示不同的复制因子和主题配置。

任何人都可以帮助您理解这种行为的原因。非常感谢您的帮助。

使用--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,segment.bytes=104857600

解决方法

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