使用命令行在kafka中使用消息时如何设置组名? [英] How to set group name when consuming messages in kafka using command line?

查看:32
本文介绍了使用命令行在kafka中使用消息时如何设置组名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

知道如何在使用命令行在 kafka 中使用消息时设置组名.

Any idea how to set group name when consuming messages in kafka using command line.

我尝试使用以下命令:

bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic nil_RF2_P2 --from-beginning --config group.id=test1
'config' is not a recognized option

目标是使用以下命令找到消耗消息的偏移量:

The goal is to find the offset of consumed messages with the following command:

bin/kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zookeeper localhost:2181 --group test1

有人可以在这方面提供帮助吗!!

Can somebody help in this regards!!

提前致谢!!

推荐答案

在命令提示符下得到了更改组名的答案!!

Got the answer to change the groupname from command prompt!!

步骤:

  1. 创建一个新的 consumer.properties 文件,比如 consumer1.properties.
  2. consumer1.properties 中更改 group.id=.
  3. bin/kafka-console-consumer.sh --new-consumer --bootstrap-server localhost:9092 --topic topicname --from-beginning --consumer.config config/consumer1.properties --delete-消费者偏移
  1. create a new consumer.properties file, say consumer1.properties.
  2. change group.id=<Give a new group name> in the consumer1.properties.
  3. bin/kafka-console-consumer.sh --new-consumer --bootstrap-server localhost:9092 --topic topicname --from-beginning --consumer.config config/consumer1.properties --delete-consumer-offsets

这篇关于使用命令行在kafka中使用消息时如何设置组名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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