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

查看:20
本文介绍了如何更改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.

我不认为你可以.通常它会像

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

./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天全站免登陆