使用命令行在kafka中使用消息时如何设置组名? [英] How to set group name when consuming messages in kafka using command line?
本文介绍了使用命令行在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!!
步骤:
- 创建一个新的
consumer.properties
文件,比如consumer1.properties
. - 在
consumer1.properties
中更改group.id=
. bin/kafka-console-consumer.sh --new-consumer --bootstrap-server localhost:9092 --topic topicname --from-beginning --consumer.config config/consumer1.properties --delete-消费者偏移
- create a new
consumer.properties
file, sayconsumer1.properties
. - change
group.id=<Give a new group name>
in theconsumer1.properties
. 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屋!
查看全文