kafka-leader-election Leader重新选举
1 指定Topic指定分区用重新PREFERRED:优先副本策略
进行Leader重选举
sh bin/kafka-leader-election.sh --bootstrap-server xxxx:9090 --topic test_create_topic4 --election-type PREFERRED --partition 0
2 所有Topic所有分区用重新PREFERRED:优先副本策略
进行Leader重选举
sh bin/kafka-leader-election.sh --bootstrap-server xxxx:9090 --election-type preferred --all-topic-partitions
3 设置配置文件批量指定topic和分区进行Leader重选举
先配置leader-election.json文件
{
“partitions”: [
{
“topic”: “test_create_topic4”,
“partition”: 1
},
{
“topic”: “test_create_topic4”,
“partition”: 2
}
]
}
sh bin/kafka-leader-election.sh --bootstrap-server xxx:9090 --election-type preferred --path-to-json-file config/leader-