Skip to content

Instantly share code, notes, and snippets.

@simsalabim
Created September 13, 2021 14:50
Show Gist options
  • Select an option

  • Save simsalabim/eb863ed7dad0ed26d94b2bec2edbb002 to your computer and use it in GitHub Desktop.

Select an option

Save simsalabim/eb863ed7dad0ed26d94b2bec2edbb002 to your computer and use it in GitHub Desktop.
Find which consumer group a Kafka topic belongs to. `TOPIC=my.topc.name ./kafka_topic_which_consumer_group.sh`
#!/bin/bash
counter=0;
for i in $(./kafka-consumer-groups.sh --list --bootstrap-server localhost:9092); do
printf '\r%3d'$counter;
if [[ $(./kafka-consumer-groups.sh --describe --group $i --bootstrap-server localhost:9092 2>/dev/null | grep $TOPIC) ]]; then
echo " " + $i
fi;
((counter++))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment