使用命令行在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=<Give a new group name>
. -
bin/kafka-console-consumer.sh --new-consumer --bootstrap-server localhost:9092 --topic topicname --from-beginning --consumer.config config/consumer1.properties --delete-consumer-offsets
- 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屋!
查看全文