Hi I am working on kafka CLI to get clear understanding how kafka works. I am confused on consumer groups. I have created topic with three partitions. I will create producer to feed some data to topic. First time I added some data as below.
kafka-console-producer --broker-list 127.0.0.1:9092 --topic users
>user1
kafka-console-producer --broker-list 127.0.0.1:9092 --topic users
>user2
kafka-console-producer --broker-list 127.0.0.1:9092 --topic users
>user3
Now my understanding is user1,user2,user3 will go randomly to three different partitions.
When creating consumer group as below.
kafka-console-consumer --bootstrap-server localhost:9092 --topic users --group user_group
This will give me all the user1,user2,user3.
Now inside one consumergroup I can have many consumers. If I have three consumer inside consumer group then first consumer will read from partition1, second consumer will read from consumer2 then third consumer will read from consumer3. This is my understanding so far. If my understanding is correct then what would be the cli command to demonstrate above behavior? I know only one command mentioned above which will return all the data? If my above understanding is correct then If all the consumer requires all the data then how to get it? Can someone help me to understand this concepts. Any help would be greatly appreciated. Thanks