I\'m new in Kafka. When I was running the quick start example in command line, I found I can\'t create multiple consumers in command line.
Condition:
I built a t
Besides using --consumer.config
option like the secfree's answer, you can also use
--consumer-property group.id=your_group
option to specify a group name without editing the config file.
When you consume Topic without groupid Kafka create random groupid for your session. You can specify groupid --consumer-property group.id=test-consumer-group if groupid exist or you can add to your session new groupid(name) when you consume if group not exist --topic second-topic --group my-first-group p and Kafka will create new group
kafka-console-consumer.sh
will create a random group.group.id=group_name
to a local file filename
--consumer.config filename
option of kafka-console-consumer.sh
to set group/consumers/
directory.Refer: kafka/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
use this:
--partition <Integer: partition> The partition to consume from.
You can use the below command to create the consumers in the group "test-consumer-group" to "test" topic:
bin/kafka-console-consumer.sh --bootstrap-server <brokerIP>:9092 --topic test --consumer-property group.id=test-consumer-group
Below command will list the consumer group configuration:
bin/kafka-consumer-groups.sh --bootstrap-server <brokerIP>:9092 --describe --group test-consumer-group
Eg:
GROUP || TOPIC || PARTITION || CURRENT-OFFSET || LOG-END-OFFSET || LAG || OWNER
test-consumer-group || test || 0 || 10 || 10 || 0 || consumer-1_/10.210.223.170