卡夫卡消费者列表 [英] Kafka consumer list

查看:31
本文介绍了卡夫卡消费者列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找到一种向 Kafka 询问主题列表的方法.我知道我可以使用 bin\ 目录中包含的 kafka-topics.sh 脚本来做到这一点.一旦我有了这个列表,我就需要每个主题的所有消费者.我在该目录中找不到脚本,在 kafka-consumer-api 库中也找不到允许我这样做的类.

I need to find out a way to ask Kafka for a list of topics. I know I can do that using the kafka-topics.sh script included in the bin\ directory. Once I have this list, I need all the consumers per topic. I could not find a script in that directory, nor a class in the kafka-consumer-api library that allows me to do it.

这背后的原因是我需要弄清楚主题的偏移量和消费者的偏移量之间的区别.

The reason behind this is that I need to figure out the difference between the topic's offset and the consumers' offsets.

有没有办法做到这一点?或者我是否需要在我的每个消费者中实现此功能?

Is there a way to achieve this? Or do I need to implement this functionality in each of my consumers?

推荐答案

使用 kafka-consumer-groups.sh

Use kafka-consumer-groups.sh

例如

bin/kafka-consumer-groups.sh  --list --bootstrap-server localhost:9092

bin/kafka-consumer-groups.sh --describe --group mygroup --bootstrap-server localhost:9092

这篇关于卡夫卡消费者列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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