How can i get all group list with kafka0.10.x
Asked Answered
H

1

6

when i use kafka0.8.x,i can get all group list with zookeeper by path /consumers/group_id, because offsets will commit to zookeeper in 0.8.x.

But in version of 0.10.x, offsets commited to kafka broker like a path /brokers/topics/__consumer_offsets and path /consumers in zookeeper has nothing. so I can not get consumer group list by zookeeper.

Hypocotyl answered 16/1, 2017 at 8:3 Comment(0)
S
16

To list all consumer groups across all topics:

 bin/kafka-consumer-groups.sh --bootstrap-server broker1:9092 --list

To view offsets for the consumer group:

 bin/kafka-consumer-groups.sh --bootstrap-server broker1:9092 --describe --group test-consumer-group

See Managing Consumer Groups for detailed information.

School answered 16/1, 2017 at 9:27 Comment(2)
Yes, it can use shell command to get group list.But any other way to get group info by API? When I get group list from zookeeper, I can get the node info to show group create time, update time,how many consumers in this group......There are so many infos I can get from zookeeper, however when offset commit to brokers the info less than before,and I want to know the structure of group and consumers, there are any documents for it?Hypocotyl
Well, no official documents offered for the detailed information about how to get these part of data using a programmatically way, but you could try AdminClient.describeGroup or AdminClient.describeConsumerGroup which both receive the group id as the only parameter. The return types are GroupSummary and List[GroupSummary] respectively. GroupSummary encapsulates most of the information you want.School

© 2022 - 2024 — McMap. All rights reserved.