问题描述
生产者或管理员创建 Kafka 主题后,您将如何更改该主题的副本数?
After a Kafka topic has been created by a producer or an administrator, how would you change the number of replicas of this topic?
推荐答案
我被证明是错误的 - 请检查 来自 Łukasz 的优秀回答杜米舍夫斯基.
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 本地主机:2181 --alter --topic test2--复制因子3
但它说
选项[replication-factor]"不能与选项[alter]"一起使用
有趣的是,您可以动态更改分区数量(这在运行时完成时通常是非常具有破坏性的操作),但不能增加复制因子,这应该是透明的.但请记住,它是 0.10,而不是 10.0...请参阅此处以获取增强请求 https://issues.apache.org/jira/browse/KAFKA-1543
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
这篇关于如何更改Kafka主题的副本数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!