Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find which consumer is assigned to which partition of a topic in kafka?

I am building a kafka manager tool and I need to check which topic-partition is assigned to which consumer in a consumer group.

Suppose there is consumer-Group group-A consuming topic topic-A with n partitions, so there can be multiple consumers in group-A hosted in different VM's. So how to find which partitioned is assigned to which consumer host? Is it possible in kafka 0.9.1?

Thanks in advance.

like image 207
Himanshu Sahu Avatar asked Sep 06 '16 11:09

Himanshu Sahu


1 Answers

You can check how $KAFKA_HOME/bin/kafka-consumer-groups.sh works and integrate its implementation into your kafka manager tool, this tool will show you detailed group owner information(for example, partition assignment, lag, IP).

GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG OWNER
page_visits_10k 0 500 3333 2833 consumer-1_/10.139.176.190
page_visits_10k 1 0 3334 3334 consumer-1_/10.139.176.190
page_visits_10k 2 0 3333 3333 consumer-1_/10.139.176.190

like image 162
Shawn Guo Avatar answered Oct 19 '22 18:10

Shawn Guo