卡夫卡消费者名单 [英] Kafka consumer list
问题描述
我需要找到一种方法来询问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屋!