Created
August 30, 2014 03:52
-
-
Save kashyapp/f4282165c3709dcdcc0c to your computer and use it in GitHub Desktop.
matrix that shows partition distribution for a topic across brokers
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/bash -e | |
/usr/share/fk-3p-kafka/bin/kafka-topics.sh $ZOOKEEPER --describe --topic $1 \ | |
| grep Leader \ | |
| awk '{print $4,$8}' | sed 's/,/ /' \ | |
| awk '{ | |
for(i=1;i<7;++i){a[i]=0}; | |
sum[$2]++; sum[$3]++; | |
a[$2]=1; a[$3]=1; | |
printf "%3d ",$1; | |
for (i=1;i<7;++i) {printf "%3d ",a[i]}; printf "\n"; | |
} END { | |
printf "sum "; | |
for (i=1;i<7;++i) {printf "%3d ",sum[i]}; printf "\n"; | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment