Tuesday, 5 November 2019

Exploring Kafka consumer groups cli


‘kafka-consumer-groups.sh’ command is used to list all consumer groups, describe a consumer group, delete consumer group info, or reset consumer group offsets.

Get all consumer groups
Below command is used to print all the consumer groups.
kafka-consumer-groups.sh --bootstrap-server {serverDetails} --list

Example
kafka-consumer-groups.sh --bootstrap-server localhost:9092 –list

$kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
myFirstConsumerGroup

Get information about a consumer group
Below command is used to get information about consumer group.

kafka-consumer-groups.sh --bootstrap-server {serverDetails} --describe --group {groupName}


Example
$kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group myFirstConsumerGroup

Consumer group 'myFirstConsumerGroup' has no active members.

GROUP                TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID     HOST            CLIENT-ID
myFirstConsumerGroup myFirstTopic    2          4               4               0               -               -               -
myFirstConsumerGroup myFirstTopic    1          5               5               0               -               -               -
myFirstConsumerGroup myFirstTopic    0          4               4               0               -               -               -

Consumer group 'myFirstConsumerGroup' has no active members.
Above statement tells that no consumer that is part of this consumer group is active (I stopped the consumers).

First consumer reading partition 2, 2nd consumer reading the partition 1 and 3rd consumer read the partition 0.


LAG 0 means consumer read all the data from the partition.


Previous                                                    Next                                                    Home

No comments:

Post a Comment