Put a kafka-config
wrapper script somewhere in your $PATH
:
#!/bin/sh
docker run -it --rm --name kafka-config \
-v `pwd`/conf:/conf \
-v `pwd`/out:/out \
smartislav/kafka-tool:0.2.0 \
-Dconfig.file=/conf/application.conf \
$@
Be sure to chmod +x
it.
Ensure that you have at least a configured number of replicas:
kafka-tool reassign -o /out/reassignment.json repair
kafka-reassign-partitions --zookeeper zk1:2181/kafka,zk2:2181/kafka --reassignment-json-file `pwd`/out/reassignment.json --execute
kafka-reassign-partitions --zookeeper zk1:2181/kafka,zk2:2181/kafka --reassignment-json-file `pwd`/out/reassignment.json --verify
Remove extra replicas that might have been created by the Kafka built-in partition reassignment tool:
kafka-tool reassign -o /out/reassignment.json cleanup
# then run kafka-reassign-partitions as in previous example
List topics that are no longer necessary (i.e. not in the config file)
kafka-tool list-superfluous-topics
Update per-topic configuration (but not no. of partitions or replication factor)
kafka-tool update --alter-if-needed