如何增加Kafka中的代理数量?

huangapple go评论47阅读模式
英文:

How to increase the number of brokers in kafka?

问题

我是新手对于Kafka。我尝试使用3个分区和3个复制因子在Kafka上创建一个主题。我正在使用本地主机来运行Kafka。

当使用以下命令时,

bin/kafka-topics.sh --create --topic activity-data --bootstrap-server localhost:9092 --replication-factor 3 --partitions 3

我收到一个错误消息,其中说道 -

ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException: Replication factor: 3 larger than available brokers: 1.

那么,我如何增加代理(brokers)的数量?

英文:

I am new to Kafka. I am trying create a topic on kafka using 3 partitions and 3 as replication factor. I am using localhost for running kafka.

When using this command,

bin/kafka-topics.sh --create --topic activity-data --bootstrap-server localhost:9092 --replication-factor 3 --partitions 3

I get an error saying -

RROR org.apache.kafka.common.errors.InvalidReplicationFactorException: Replication factor: 3 larger than available brokers: 1.

So, how do I increase the number of brokers ?

答案1

得分: 2

首先,复制品和分区不需要匹配。您可以在单个代理上创建成千上万个分区。

Kafka 最适合作为一个集群运行,获得更多的副本唯一的方式是添加相同数量的服务器(代理)。因此,您需要在其他服务器上安装 Kafka 并创建一个集群(即使用更多的机器,而不是在本地主机上运行所有内容)。

这在文档中有很好的解释。

英文:

First, replicas and partitions do not need to match. You can create thousands of partitions on a single broker.

Kafka runs best as a cluster, and is the only way to get more replicas is to add that many servers (brokers). Therefore, you install Kafka on other servers and make a cluster (i.e. use more machines, and not run everything on localhost)

This is explained very well in the documentation.

huangapple
  • 本文由 发表于 2023年6月15日 00:59:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76475937.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定