如何加载余额卡夫卡?

发布于 2025-01-29 14:02:18 字数 100 浏览 3 评论 0 原文

谁能帮助我在卡夫卡(Kafka)的负载平衡?要实施什么逻辑?我认为部署多经纪人多节点KAFKA可以解决问题吗?而且,如果有人可以指导我增加分区的增加可能会影响卡夫卡的负载平衡和吞吐量吗?

Can anyone help me with load balancing in kafka? what logic is to be implemented? I think that deploying multi broker multi node kafka will resolve the issue? And also if someone can guide me that increase in partitions may effect load balancing and throughput of kafka?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

面如桃花 2025-02-05 14:02:18

如果您是指扩展Kafka群集,那么您需要做的最低限度是:

  • 中添加更多的经纪人
  • 主题和分区

在此处描述的 : https://kafka.apache.org/documentation/#basic_ops_cluster_cluster_expansion

将服务器添加到Kafka群集非常容易,只需为它们分配一个唯一的代理ID,然后在新服务器上启动Kafka即可。但是,这些新服务器不会自动分配任何数据分区,因此,除非将分区移至它们,否则在创建新主题之前,他们不会做任何工作。因此,通常,当您将机器添加到群集中时,您都需要将一些现有数据迁移到这些机器上。

一旦将分区转移到新节点后,消费者和生产商将自动重新平衡使用新节点。

要了解消费者和生产商如何通过分区数量进行扩展,我建议阅读Kafka关键概念:

主题是分区的,这意味着主题分布在不同Kafka经纪人上的许多“存储桶”上。该数据的分布式放置对于可伸缩性非常重要,因为它允许客户端应用程序同时读取和写入/向许多经纪人读取数据。当将新事件发布到主题上时,实际上会附加到主题的一个分区之一。具有相同事件密钥(例如,客户或车辆ID)的事件被写入同一分区,Kafka保证,任何给定主题分区的消费者都会以与编写完全相同的顺序读取该分区的事件。

If you mean scaling a Kafka cluster, the bare minimum you need to do is:

  • Add more brokers to the cluster
  • Rebalance the topics and partitions

It is described in here: https://kafka.apache.org/documentation/#basic_ops_cluster_expansion

Adding servers to a Kafka cluster is easy, just assign them a unique broker id and start up Kafka on your new servers. However these new servers will not automatically be assigned any data partitions, so unless partitions are moved to them they won't be doing any work until new topics are created. So usually when you add machines to your cluster you will want to migrate some existing data to these machines.

Consumers and producers will automatically rebalance to use the new nodes once their partitions have been moved to the new nodes.

To understand how consumers and producers scale with the number of partitions I recommend reading Kafka key concepts: https://kafka.apache.org/documentation/#intro_concepts_and_terms

Topics are partitioned, meaning a topic is spread over a number of "buckets" located on different Kafka brokers. This distributed placement of your data is very important for scalability because it allows client applications to both read and write the data from/to many brokers at the same time. When a new event is published to a topic, it is actually appended to one of the topic's partitions. Events with the same event key (e.g., a customer or vehicle ID) are written to the same partition, and Kafka guarantees that any consumer of a given topic-partition will always read that partition's events in exactly the same order as they were written.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文