设置的是手动提交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回滚了,引起大量的重复消费,怎么解决?
poll()
消息之后,处理的时间超过了默认30秒
,commitSync
同步offset的时候,已经失去了消费者的资格,因为kafka是按批来拉取的消息,一批数据处理的时间过长,导致很久没有poll
,导致的。你可以通过增加
max.poll.interval.ms
或者通过max.poll.records
减少poll()
中返回的最大批次大小来解决这个问题。相关的错误和解决方法和参考:https://www.orchome.com/6742
你的答案