CLI Consumer in Groups with kafka-console-consumer.sh
# Replace "kafka-console-consumer.sh"
# by "kafka-console-consumer" or "kafka-console-consumer.bat" based on your system # (or bin/kafka-console-consumer.sh or bin\windows\kafka-console-consumer.bat if you didn't setup PATH / Environment variables)
# start one consumer
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first_topic --group my-first-application
# start one producer and start producing
kafka-console-producer.sh --bootstrap-server localhost:9092 --topic first_topic
# start another consumer part of the same group. See messages being spread
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first_topic --group my-first-application
# start another consumer part of a different group from beginning
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first_topic --group my-second-application --from-beginning
Consumer Group Management CLI kafka-consumer-groups.sh
# Replace "kafka-consumer-groups.sh"
# by "kafka-consumer-groups" or "kafka-consumer-groups.bat" based on your system # (or bin/kafka-consumer-groups.sh or bin\windows\kafka-consumer-groups.bat if you didn't setup PATH / Environment variables)
# documentation for the command
kafka-consumer-groups.sh
# list consumer groups
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
# describe one specific group
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group my-second-application
# describe another group
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group my-first-application
# start a consumer
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first_topic --group my-first-application
# describe the group now
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group my-first-application
# describe a console consumer group (change the end number)
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group console-consumer-10592
# start a console consumer
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first_topic --group my-first-application
# describe the group again
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group my-first-application
标签:group,CLI,--,Consumer,kafka,sh,Groups,console,consumer
From: https://www.cnblogs.com/Bota5ky/p/17034808.html