The kafka-consumer-groups Command
Explore how to effectively use the kafka-consumer-groups command to inspect Kafka consumer groups, including their member count, partition assignments, offsets, lag, and rebalancing status. Understand how to scale consumers and add new consumer groups to optimize real-time stream processing applications.
It is time we add the final tool in our tool belt—the kafka-consumer-groups command, which can be an important aid in understanding and debugging Kafka Streams applications. We’ll be using this command to:
See how many members exist in a group.
Which partition (or partitions) each member is assigned.
Check the offset of each partition and consumer.
Check if the group is rebalancing.
Setting up the system
We learned about consumer groups using an example that contained:
A topic with three partitions called
payments.A producer writing messages to the topic.
A consumer group called
processors, which started with one consumer and ended up with three.Another consumer group called
reports, with one member.
We’ll be using the terminal below to run the different services in the system.
Creating the payments topic
Let’s start the terminal and create a new topic called payments with three partitions: