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 | |
brokerids="10,20,30" | |
topics=`bin/kafka-topics.sh --list --zookeeper kafka1:2181` | |
while read -r line; do lines+=("$line"); done <<<"$topics" | |
echo '{"version":1, | |
"partitions":[' > tmp.json | |
for t in $topics; do | |
sep="," |
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
Kafka shell command: | |
1) Get list all topic: | |
./kafka-topics.sh --zookeeper <zookeeper_host:port> --list | |
./bin/kafka-topics.sh --zookeeper kafka1:2181 --list | |
./bin/kafka-topics.sh --zookeeper kafka1:2181 --describe | |
2) Create topic: | |
./kafka-topics.sh --create --zookeeper <zookeeper_host:port> --replication-factor <number_replica> --partitions <number_partition> --topic <topic_name> | |
./bin/kafka-topics.sh --create --zookeeper kafka1:2181 --replication-factor 3 --partitions 8 --topic proximity |