InfoQ 2022-08-06 19:32:14 阅读数:447
__consumer_offsets_
__consumer_offsets
kafka_consumer_groups.sh
__consumer_offsets
__consumer_offsets
group.id+topic+分区号
consumer
consumer group
group.id
Math.abs(groupID.hashCode()) % numPartitions
__consumer_offsets
offsets.topic.replication.factor
offsets.topic.num.partitions
消费组:szz1-group
topic:szz1-test-topic
bin/kafka-console-consumer.sh --bootstrap-server xxx1:9092,xxx2:9092,xxx3:9092 --group szz1-group --topic szz1-test-topic
bin/kafka-console-producer.sh --broker-list xxx1:9092,xxx2:9092,xxx3:9092 --topic szz1-test-topic
bin/kafka-consumer-groups.sh --bootstrap-server xxx1:9092,xxx2:9092,xxx3:9092 --describe --group szz1-group
partition
partition
CURRENT-OFFSET: 当前消费组消费到的偏移量
LOG-END-OFFSET: 日志最后的偏移量
CURRENT-OFFSET
LOG-END-OFFSET
partition-0
partition-1
LOG-END-OFFSET: 日志最后的偏移量
CURRENT-OFFSET: 当前消费组消费到的偏移量
szz1-group3
bin/kafka-console-consumer.sh --bootstrap-server xxx1:9092,xxx2:9092,xxx3:9092 --group szz1-group3 --topic szz1-test-topic
bin/kafka-consumer-groups.sh --bootstrap-server xxx1:9092,xxx2:9092,xxx3:9092 --describe --group szz1-group3
CURRENT-OFFSET
LOG-END-OFFSET
--from-beginning
Math.abs(groupID.hashCode()) % numPartitions
consume_group
"szz1-group".hashCode()%50=32
szz-group
__consumer_offsets_32
bin/kafka-simple-consumer-shell.sh --topic __consumer_offsets --partition 32 --broker-list xxx1:9092,xxx2:9092,xxx3:9092 --formatter "kafka.coordinator.group.GroupMetadataManager\$OffsetsMessageFormatter"
bin/kafka-topics.sh --describe --zookeeper xxx:2181 --topic TOPIC名称
copyright:author[InfoQ],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/218/202208061921177127.html