Created
September 21, 2020 19:55
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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