如何更改Kafka主题的副本数? [英] How to change the number of replicas of a Kafka topic?

查看:64
本文介绍了如何更改Kafka主题的副本数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

生产者或管理员创建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.

我认为你不能.通常是

./kafka-topics.sh --zookeeper本地主机:2181 --alter --topic test2-复制因子3

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

但它说

选项"[replication-factor]"不能与选项"[alter]"一起使用

Option "[replication-factor]" can't be used with option"[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主题的副本数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆