Skip to content

Instantly share code, notes, and snippets.

@Esl1h
Created September 21, 2020 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Esl1h/59950a3d73a63ec12404cf1ed6e68f6d to your computer and use it in GitHub Desktop.
Save Esl1h/59950a3d73a63ec12404cf1ed6e68f6d to your computer and use it in GitHub Desktop.
List kafka topics and partitions. Lista as partições dos tópicos no kafka.
#!/bin/sh
path="/opt/kafka_2.12-2.2.2/bin"
$path/kafka-topics.sh --zookeeper zookeeper.intranet:2181 --list | grep -v "__consumer_offsets" > topic.txt
cat topic.txt | while read line
do
partitions=`$path/kafka-topics.sh --describe --zookeeper zookeeper.intranet:2181 --topic $line | grep PartitionCount | awk '{ print $1,$2 }'`
echo $partitions
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment