What Can I Do When kafka-reassign-partitions.sh Does Not Have a Rollback Solution?
Symptom
After the kafka-reassign-partitions.sh task completes, no rollback solution is available.
Procedure
- Log in as a client installation user to the node on which the Kafka client is installed.
- Switch to the Kafka client installation directory, for example, /opt/client.
cd /opt/client
- Run the following command to configure environment variables:
source bigdata_env
- Run the following command to authenticate the user (skip this step in normal mode):
kinit Component service user
- Run the following command to switch to the Kafka client installation directory:
cd Kafka/kafka
- Obtain the original partition and replica distribution before executing the reassignment.
./bin/kafka-reassign-partitions.sh --bootstrap-server <Kafka cluster IP address:Port> --topics-to-move-json-file topic.json --broker-list "BrokerId1,BrokerId2,..." --generate --command-config config/client.properties | sed -n '2p' > JSON file
Example:
./bin/kafka-reassign-partitions.sh --bootstrap-server 192.168.1.1:21007 --topics-to-move-json-file topic.json --broker-list "1,2,3" --generate --command-config config/client.properties | sed -n '2p' > original.json
- The topic.json file contains the topics for reassignment, formatted as follows: {"topics": [{"topic": "topic1-name"},{"topic": "topic2-name"}], "version": 1}
- --broker-list: The IDs of the target brokers. Separate multiple IDs with commas (,). The number of IDs must be equal to or greater than the number of brokers used in the original topic assignment.
- The original.json file is an output file that saves the current partition replica distribution for verification or rollback.
- To roll back the reassignment, run the following command:
./bin/kafka-reassign-partitions.sh --bootstrap-server <Kafka cluster IP address: Port> --reassignment-json-file JSON file obtained in 6 --execute --command-config ../config/client.properties
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot