Reassign Partition
Prerequisite
Start Cluster
make sure to stop all kafka & zookeeper server
by ctrl+c in your terminal or
call kafka-server-stop.sh for kafka broker and call zookeeper-server-stop.sh for zookeeper
make sure with jps command
clear zookeeper & kafka data
rm -rf /tmp/zookeeper* rm -rf /tmp/kafka*start the Zookeeper and Kafka cluster from the Red Hat AMQ Streams Architecture. This cluster will be used for this lab. run cli in each terminal (1 shell script 1 terminal)
cd ~/amq-streams-2022/2-amq-streams-architecture/ ./scripts/zookeeper-0.sh ./scripts/zookeeper-1.sh ./scripts/zookeeper-2.sh ./scripts/kafka-0.sh ./scripts/kafka-1.sh ./scripts/kafka-2.sh
Topic Reassignments
First, create a new topic which will be later used for reassigning:
view topic detial, keep information about topic
example result, keep information about leader such as leader:0
load data to topic
Next, we generate reassignment file.
Check the topics-to-move.json file which tells the tool for which topics should the file be generated.
example of topics-to-move.json
generate reassign file, change broker-list to another value except value from leader info from previous describe topic command (such as previous command leader:0, set broker-list to 1,2 from 0,1,2 or if leader:1, set broker-list to 0,2 etc.)
example result
copy this proposed partition reassignment and paste it in a local reassign-partition.json file
Next we can use the prepared file to trigger the reassignment.
example result
check reassign partition status
example result
check partition information again
example result, make sure leader change, replicas change
Last updated