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

后端 未结 8 806
离开以前
离开以前 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:52

    Edit: I was proven to be wrong - please check excellent answer from Łukasz Dumiszewski.

    I'm leaving my original answer for completness for now.



    I don't think you can. Normally it would be something like

    ./kafka-topics.sh --zookeeper localhost:2181 --alter --topic test2 --replication-factor 3

    but it says

    Option "[replication-factor]" can't be used with option"[alter]"

    It is funny that you can change number of partitions on the fly (which is often hugely destructive action when done in runtime), but cannot increase replication factor, which should be transparent. But remember, it is 0.10, not 10.0... Please see here for enhancement request https://issues.apache.org/jira/browse/KAFKA-1543

提交回复
热议问题