gpt4 book ai didi

apache-kafka - "Rebalancing"在 Apache Kafka 上下文中意味着什么?

转载 作者:行者123 更新时间:2023-12-03 07:15:53 24 4
gpt4 key购买 nike

我是 Kafka 的新用户,现在已经试用了大约 2-3 周。我相信目前我对 Kafka 的大部分工作原理有了很好的理解,但是在尝试为我自己的 Kafka 消费者安装 API 之后(这很晦涩,但我正在遵循新的 KafkaConsumer 的指南,该指南应该适用于 v 0.9,该版本位于“trunk”存储库 atm 上)如果我有多个具有相同 groupID 的消费者,我会遇到从主题消费的延迟问题。

在此设置中,我的控制台始终记录有关“重新平衡触发”的问题。当我向消费者组添加新消费者时,是否会发生重新平衡,并且它们会被触发,以便确定同一 groupID 中的哪个消费者实例将获得哪些分区,或者重新平衡完全用于其他用途?

我也从 https://cwiki.apache.org/confluence/display/KAFKA/Kafka+0.9+Consumer+Rewrite+Design 看到了这段话我似乎无法理解它,所以如果有人能帮助我理解它,我将不胜感激:

Rebalancing is the process where a group of consumer instances(belonging to the same group) co-ordinate to own a mutually exclusiveset of partitions of topics that the group is subscribed to. At theend of a successful rebalance operation for a consumer group, everypartition for all subscribed topics will be owned by a single consumerinstance within the group. The way rebalancing works is as follows.Every broker is elected as the coordinator for a subset of theconsumer groups. The co-ordinator broker for a group is responsiblefor orchestrating a rebalance operation on consumer group membershipchanges or partition changes for the subscribed topics. It is alsoresponsible for communicating the resulting partition ownershipconfiguration to all consumers of the group undergoing a rebalanceoperation.

最佳答案

当新消费者加入消费者组时,消费者组会尝试“重新平衡”负载以将分区分配给每个消费者。如果在进行分配时消费者集合发生变化,则重新平衡将失败并重试。此设置控制放弃之前的最大尝试次数。

执行此操作的命令是:rebalance.max.retries,默认设置为 4。

此外,如果满足以下条件,则可能会发生这种情况:

ZooKeeper session 超时。如果消费者在这段时间内未能向ZooKeeper发送心跳,则认为消费者已死亡,并会发生重新平衡。

希望这有帮助!

关于apache-kafka - "Rebalancing"在 Apache Kafka 上下文中意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30988002/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com