How to change the number of replicas of a Kafka topic?

后端 未结 8 807
离开以前
离开以前 2020-11-30 21:31

After a Kafka topic has been created by a producer or an administrator, how would you change the number of replicas of this topic?

8条回答
  •  鱼传尺愫
    2020-11-30 21:54

    Łukasz Dumiszewski's answer is correct but manually generating that file is a bit hard. Luckily there are some easy ways to achieve what @Łukasz Dumiszewski said.

    • If you are using kafka-manager tool, from version 2.0.0.2 you can change the replication factor in Generate Partition Assignment section in a topic view. Then you should click on Reassign Partitions to apply the generated partition assignment (if you select a different replication factor, you will get a warning but you can click on Force Reassign afterward).

    • If you have ruby installed you can use this helper script

    • If you prefer nodejs you can generate the file with this gist too.

提交回复
热议问题