# https://catalog.workshops.aws/msk-labs/en-US/addingbrokers/reassignpartitions $ cat < topics-to-move.json { "topics": [ { "topic" : "my-topic"}, { "topic" : "__consumer_offsets"} ], "version":1} EOF $ cat < client.properties security.protocol=SSL # ... EOF $ export KAFKA_BROKERS="..." # Example of repalancing partitions amoung 6 brokers: $ bin/kafka-reassign-partitions.sh --bootstrap-server "${KAFKA_BROKERS}" --command-config client.properties --topics-to-move-json-file topics-to-move.json --broker-list "1,2,3,4,5,6" --generate | awk -F: '/Proposed partition reassignment configuration/ { getline; print $0 }' | jq . > expand-cluster-reassignment.json $ cat expand-cluster-reassignment.json $ bin/kafka-reassign-partitions.sh --bootstrap-server "${KAFKA_BROKERS}" --command-config client.properties --reassignment-json-file expand-cluster-reassignment.json --execute $ bin/kafka-reassign-partitions.sh --bootstrap-server "${KAFKA_BROKERS}" --command-config client.properties --reassignment-json-file expand-cluster-reassignment.json --verify