目录
准备迁移的topic
比如迁移topicA、topicB
vim topics-to-move.json
{"topics": [{"topic": "topicA"},
{"topic": "topicB"}],
"version":1
}
生成分区策略json
--broker-list "1,2,3,4,5" ,即所有当前可用broker id
bin/kafka-reassign-partitions.sh --zookeeper zk1:2181 --topics-to-move-json-file topics-to-move.json --broker-list "1,2,3,4,5" --generate > result.json
结果json写入result.json中
#当前分区情况
Current partition replica assignment
{"version":1,"partitions":[{"topic":"topicA","partition":2,"replicas":[0,2]},
{"topic":"topicA","part
本文详细介绍了Kafka的分区迁移步骤,包括准备迁移的topic,生成分区策略json,执行迁移,查看进度,并给出了最佳实践。在迁移前,需确保数据安全,如设置较短的分片保留时间,迁移后要恢复设置,避免因数据量大导致节点下线。
订阅专栏 解锁全文
115

被折叠的 条评论
为什么被折叠?



