...

/

The kafka-consumer-groups Command

The kafka-consumer-groups Command

Run multiple instances of consumer in a consumer group and analyze the system using the kafka-consumer-groups command.

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.

Terminal 1
Terminal
Loading...

Creating the payments topic

Let’s start the terminal and create a new topic called payments with three partitions:

Press + to interact
/kafka/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --topic payments --partitions 3

Starting a single payment processor

...