Command to view Partitions and Offsets of Kafka Topics

Kafka comes with many tools, one of them is kafka-consumer-groups that help to list all consumer groups, describe a consumer group, reset consumer group offsets, and delete consumer group information. We will use this tool to view partitions and offsets of Kafka topics.

To view partitions and offsets in Kafka topics, follow these steps:

  1. Open a Windows PowerShell or terminal and navigate to your Kafka directory:
  2. cd path/to/your/kafka
  3. Run this command (Replace test-group-id with your consumer group id):
  4. .\bin\windows\kafka-consumer-groups.bat --bootstrap-server localhost:9092 --group test-group-id --describe
    ./bin/ --bootstrap-server localhost:9092 --group test-group-id --describe

    The output of the above command will be something like this:

    test-group-id	my-topic-name	0	85	97	12	-
    test-group-id	my-topic-name	1	77	124	47	-
    test-group-id	my-topic-name	2	74	104	30	-
    test-group-id	my-topic-name	3	78	121	43	-
    test-group-id	my-topic-name	4	43	122	79	-