如何从 kafka(0.10.x) 获取组提交偏移量 [英] how to get the group commit offset from kafka(0.10.x)

查看:31
本文介绍了如何从 kafka(0.10.x) 获取组提交偏移量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

group 的 offsets 信息之前存储在 zookeeper 中.现在,在 Kafka Cluster (0.10.x) 中,偏移量信息存储在名为 __consumer_offsets 的主题中.

The offsets informations of the group were stored in zookeeper before. Now, in the Kafka Cluster (0.10.x), the offsets informations are stored in the topic which's name is __consumer_offsets.

但是我怎样才能得到我指定的组的偏移量信息?

But how could I get the offsets information of the group which I specified?

推荐答案

对于活动组,调用下面的命令来检索偏移量:

For active groups, invoke command below to retrieve the offsets:

bin/kafka-consumer-groups.sh --bootstrap-server broker1:9092 --describe --group test-consumer-group

对于非活动组,首先通过计算Math.abs(groupId.hashCode()) % 50得到目标偏移主题分区号,然后调用:

For inactive groups, first get the target offset topic partition number by calculating Math.abs(groupId.hashCode()) % 50, then invoke:

bin/kafka-simple-consumer-shell.sh --topic __consumer_offsets --partition <calculated number> --broker-list broker1:9092 --formatter "kafka.coordinator.GroupMetadataManager\$OffsetsMessageFormatter"

查找组的偏移量.

这篇关于如何从 kafka(0.10.x) 获取组提交偏移量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆