Managing consumer groups
The ConsumerGroupCommand
tool is valuable when debugging consumer groups. This tool allows us to list, describe, and delete consumer groups.
Getting ready
For this recipe, Kafka must be installed, ZooKeeper running, the broker running, and some topics created on it. The topics should have produced some messages and have some consumers created in a consumer group. The point here is to get some information about the running consumers.
How to do it...
- From the Kafka installation directory, run the following command:
$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
The output is something like the following:
Note: This will only show information about consumers that use the Java consumer API (non-ZooKeeper-based consumers).console-consumer-10354vipConsumersGroupconsole-consumer-44233
- To see the offsets, use
describe
on the consumer group as follows:
$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group vipConsumersGroupNote...