kafka分区迁移失败任务的处理
前一个文章"单副本kafka迁移分区"介绍了,怎样对分区进行迁移,然而在迁移最后一台broker的过程中,controler挂掉了,导致迁移任务一直没有进度,这里记录一下处理的过程
如果有一个迁移任务在执行时,重复执行,会有下面的提示,./bin/kafka-reassign-partitions.sh 是不能进行取消或者更改迁移任务状态的。
kafka.common.AdminCommandFailedException: Partition reassignment currently in progress for Map
处理思路:
1.登陆zk,把当前的任务删除
2.重新执行任务
具体操作:
2.1.登陆zk,删除任务
[zk: localhost:8181(CONNECTED) 2] ls /
[cluster, controller_epoch, controller, brokers, zookeeper, kafka-manager, admin, isr_change_notification, consumers, burrow, latest_producer_id_block, config]
[zk: localhost:8181(CONNECTED) 3] ls /admin/reassign_partitions
[]
#查看当前的任务
[zk: localhost:8181(CONNECTED) 5] get /admin/reassign_partitions
{"version":1,"partitions":[{"topic":"yuanlog_json","partition":589,"replicas":[135]},{"topic":"………………
cZxid = 0x403a9ff6a
ctime = Thu Jul 25 10:50:12 CST 2019
mZxid = 0x403c68a74
mtime = Fri Jul 26 05:47:36 CST 2019
pZxid = 0x403a9ff6a
cversion = 0
dataVersion = 136189
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 9348
numChildren = 0
#删除任务
[zk: localhost:8181(CONNECTED) 8] rmr /admin/reassign_partitions
[work@kafka-node-134 kafka_2.11-0.10.0.0]$ ./bin/kafka-reassign-partitions.sh --zookeeper 10.69.59.186:8181 --reassignment-json-file ./tmp/136_exec0801.json --execute
Current partition replica assignment
2.2 重新执行迁移任务
[work@kafka-node-134 kafka_2.11-0.10.0.0]$ ./bin/kafka-reassign-partitions.sh --zookeeper 10.10.10.1:8181 --reassignment-json-file ./tmp/136_exec0801.json --execute
Current partition replica assignment
………………
Successfully started reassignment of partitions {"version":1,"partitions":[{"topic":"XX","partition":237,"replicas":[157]}]}
2.3 查看任务状态
[work@kafka-node-134 kafka_2.11-0.10.0.0]$ ./bin/kafka-reassign-partitions.sh --zookeeper 10.10.10.1:8181 --reassignment-json-file ./tmp/136_exec0801.json --verify