gpt4 book ai didi

Spring Boot Kafka : Commit cannot be completed since the group has already rebalanced

转载 作者:行者123 更新时间:2023-12-03 08:16:35 31 4
gpt4 key购买 nike

今天,在我的 Spring Boot 和单实例 Kafka 应用程序中,我遇到了以下问题:

org.apache.kafka.clients.consumer.CommitFailedException: Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that the time between subsequent calls to poll() was longer than the configured max.poll.interval.ms, which typically implies that the poll loop is spending too much time message processing. You can address this either by increasing the session timeout or by reducing the maximum size of batches returned in poll() with max.poll.records.



这可能是什么原因以及如何解决?据我了解 - 我的消费者被阻塞了很长时间并且没有响应心跳。我应该调整 Kafka 属性以解决它。您能否告诉我应该调整哪些确切的属性以及在哪里,例如在 Kafka 端或在我的应用程序 Spring Kafka 端?

最佳答案

默认情况下,Kafka 会返回一批记录 fetch.min.bytes (默认 1)最多为 max.poll.records (默认 500),或 fetch.max.bytes (默认 52428800),否则会等待 fetch.wait.max.ms (默认 100)在返回一批数据之前。您的消费者需要对该数据进行一些处理,然后调用 poll()再次。您的消费者的工作预计将在 max.poll.interval.ms 内完成(默认 300000 - v2.0 之前的 5 分钟和 v2.0 之后的 30000 - 30 秒)。如果在此超时到期之前没有调用 poll(),则认为消费者失败,组将重新平衡以将分区重新分配给另一个成员。

因此,要解决您的问题,请减少返回的消息数量,或增加 max.poll.interval.ms属性以避免超时和重新平衡。

关于Spring Boot Kafka : Commit cannot be completed since the group has already rebalanced,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51631894/

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