kafka消费时候,报Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. T

小蕊 发表于: 2016-11-18   最后更新时间: 2022-06-02 14:09:55   20,637 游览

设置的是手动提交offset,这一行报错

consumer.commitSync 

报了以下错误

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 session.timeout.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.

导致我的offset回滚了,引起大量的重复消费,怎么解决?

发表于 2016-11-18
添加评论

poll()消息之后,处理的时间超过了默认30秒commitSync同步offset的时候,已经失去了消费者的资格,因为kafka是按批来拉取的消息,一批数据处理的时间过长,导致很久没有poll,导致的。

你可以通过增加max.poll.interval.ms或者通过max.poll.records减少poll()中返回的最大批次大小来解决这个问题。

相关的错误和解决方法和参考:https://www.orchome.com/6742

你的答案

查看kafka相关的其他问题或提一个您自己的问题