kafka-console-consumer消费者使用什么消费群 [英] What consumer group does kafka-console-consumer use

查看:442
本文介绍了kafka-console-consumer消费者使用什么消费群的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我像这样运行kafka-console-consumer时

When i run kafka-console-consumer like so

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test

它默认为哪个消费群体?如果我没有在命令行中指定使用者组或链接到使用者属性,它最终会使用随机使用者组吗?如何检查使用了哪个消费群体?

What consumer group does it default to? Does it end up using a random consumer group if I don't specify consumer group or link to consumer properties in the command line? How can I check what consumer group was used?

谢谢!

推荐答案

如果未指定组,则kafka-console-consumer.sh会生成具有以下格式的随机使用者组:

If a group is not specified, the kafka-console-consumer.sh generates a random consumer group with this format:

console-consumer-${new Random().nextInt(100000)}

请参阅ConsoleConsumer scala类: https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/tools/ConsoleConsumer.scala#L370

See the ConsoleConsumer scala class: https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/tools/ConsoleConsumer.scala#L370

不幸的是,要找到生成的组ID,您必须:

Unfortunately to find the generated group id, you have to:

  • 查看控制台使用者日志
  • 列出所有组(例如,使用kafka-consumer-groups工具并过滤以console-consumer-开头的组.
  • look at the console consumer logs
  • list all groups (for example using the kafka-consumer-groups tool and filter for group starting with console-consumer-.

这篇关于kafka-console-consumer消费者使用什么消费群的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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