简体   繁体   English

Kafka Cluster 和 Kafka Broker 有什么区别?

[英]What is the difference between Kafka Cluster and Kafka Broker?

Has Kafka cluster and Kafka broker the same meaning? Kafka clusterKafka broker的含义相同吗?

I know cluster has multiple brokers (Is this wrong?).我知道集群有多个代理(这是错的吗?)。

But when I write code to produce messages, I find awkward option .但是当我编写代码来生成消息时,我发现option很尴尬。

props.put("bootstrap.servers", "kafka001:9092, kafka002:9092, kafka003:9092");

Is this broker address or cluster address?这是代理地址还是集群地址? If this is broker address, I think it is not good because we have to modify above address when brokers count changes.如果这是broker地址,我认为不好,因为当broker计数发生变化时,我们必须修改上面的地址。
(But it seems like broker address..) (但它似乎是经纪人地址..)

Additionally, I saw in MSK in amazon, we can add broker to each AZ .此外,我在亚马逊的MSK中看到,我们可以将代理添加到每个AZ
It means, we cannot have many broker.这意味着,我们不能有很多经纪人。 (Three or four at most?) (最多三四个?)

And they guided we should write this broker addresses to bootstrap.server option as a ,` seperated list.他们指导我们应该将这个代理地址写入 bootstrap.server option as a ,` 分隔列表。

Why they don't guide us to use clusters address or ARN ?为什么他们不指导我们使用集群地址或ARN

A Kafka cluster is a group of Kafka brokers . Kafka cluster是一组Kafka brokers

When using the Producer API it is not required to mention all brokers within the cluster in the bootstrap.servers properties.使用 Producer API 时,不需要在bootstrap.servers属性中提及集群内的所有代理。 The Producer configuration documentation on bootstrap.servers gives the full details: bootstrap.servers上的 Producer 配置文档提供了完整的详细信息:

A list of host/port pairs to use for establishing the initial connection to the Kafka cluster.用于建立与 Kafka 集群的初始连接的主机/端口对列表。 The client will make use of all servers irrespective of which servers are specified here for bootstrapping—this list only impacts the initial hosts used to discover the full set of servers.客户端将使用所有服务器,无论此处指定哪些服务器进行引导——此列表仅影响用于发现完整服务器集的初始主机。 This list should be in the form host1:port1,host2:port2,.... Since these servers are just used for the initial connection to discover the full cluster membership (which may change dynamically), this list need not contain the full set of servers (you may want more than one, though, in case a server is down).此列表应采用 host1:port1,host2:port2,.... 的形式。由于这些服务器仅用于初始连接以发现完整的集群成员(可能会动态更改),因此此列表不需要包含完整集服务器数量(但您可能需要多个服务器,以防服务器停机)。

All brokers within a cluster share meta information of other brokers in the same cluster.集群中的所有代理共享同一集群中其他代理的元信息。 Therefore, it is sufficient to mention even only one broker in the bootstrap-servers properties.因此,在bootstrap-servers属性中只提及一个代理就足够了。 However, you should still mention more than one in case of the one broker being not available for whatever reason.但是,如果由于某种原因无法使用一个经纪人,您仍然应该提及不止一个经纪人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM