简体   繁体   中英

kafka sarama lib how to know how many cosumers in a cosumergroup

I read the consumer group example in here (provided by Shopify/sarama), and I wonder that how would I know how many consumers are in a consumer group, are there any ways I could control the number of consumers?

Thanks a lot

To list the consumers currently assigned to a group, you can use the kafka-consumer-groups .sh shell script. Assuming that $KAFKA_HOME is the root directory of your Kafka installation, you can do:

$KAFKA_HOME/bin/kafka-consumer-groups.sh --describe --group YOURGROUP --zookeeper ZOOKEEPER_HOST:PORT

If you want to list current groups, run the following command:

$KAFKA_HOME/bin/kafka-consumer-groups.sh --list --zookeeper ZOOKEEPER_HOST:PORT

You can use ClusterAdmin interface in Sarama library.

https://pkg.go.dev/github.com/Shopify/sarama#ClusterAdmin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM