Kafka提供了重新分区的命令,但是只能增加,不能减少
我的kafka安装在/usr/local/kafka_2.12-1.0.2目录下面,
[root@i-zk1 kafka_2.-]# bin/kafka-topics. --topic test Topic:test PartitionCount: ReplicationFactor: Configs: Topic: test Partition: Leader: Replicas: Isr:
查看当前topic test为一个分区,一个Repli
执行如下
bin/kafka-reassign-partitions. --reassignment-json-file repartion_config/test.json --execute test.json
其中test.json内容如下
[root@i-zk1 kafka_2.-]# cat repartion_config/test.json {,,,,]},{,,,]},{,,,]}]}
再次查看test topic如下
[root@i-zk1 kafka_2.-]# bin/kafka-topics. --topic test Topic:test PartitionCount: ReplicationFactor: Configs: Topic: test Partition: Leader: Replicas: ,, Isr: ,, Topic: test Partition: Leader: Replicas: ,, Isr: ,, Topic: test Partition: Leader: Replicas: ,, Isr: ,,