kafka.errors.CommitFailedError:max_poll_interval_ms

博客讨论了在使用Kafka消费者时遇到的CommitFailedError问题,由于处理时间超过max_poll_interval_ms设置的1小时导致消费者组重新平衡。尽管已尝试将该参数设置为3600000毫秒,但在实际操作中仍出现超时错误。解决方案包括增加rebalance超时时间,减少poll()返回的批次大小,以及调整其他相关配置如request_timeout_ms和session_timeout_ms。这有助于确保消费者能够有效地处理消息并避免被踢出消费组。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

kafka.errors.CommitFailedError: CommitFailedError: 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 rebalance timeout with max_poll_interval_ms,
            or by reducing the maximum size of batches returned in poll()
            with max_poll_records.

在配置文件里设置了max_poll_interval_ms:3600000,1个小时,但实际处理的时候,还是显示超时

实际用的时间还没有1分钟。

修改配置,解决问题

'max_poll_interval_ms': 60 * 60 * 1000,  # 处理逻辑最大时间,一旦Consumer处理不过来,就会被踢出Consumer Group
        'request_timeout_ms': 40 * 60*1000,  # 表示消费者再重新发送请求或达到最大重试次数之前等待相应请求的最大时间
        'connections_max_idle_ms': 50 * 60*1000,  # 心跳会话超时间隔
        'session_timeout_ms': 30 * 60*1000, 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值