我正在运行一个有4个节点,1个生产者和1个消费者的Kafka集群。直到消费者失败,它一直运转良好。现在,在重新启动使用者后,它开始使用新消息,但是几分钟后,它引发了此错误:
[WARN ]: org.apache.kafka.clients.consumer.internals.ConsumerCoordinator - Auto offset commit failed for group eventGroup: 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.
它开始再次使用相同的消息并永远循环。
我增加了会话超时时间,尝试更改组ID,但它仍然执行相同的操作。
Kafka客户的客户端版本也很重要吗?
答案 0 :(得分:1)
我建议您首先将使用者和处理逻辑脱钩。例如。让Kafka使用者仅轮询消息,并在清理完消息(如有必要)之后将每个记录的实际处理委托给单独的线程,然后查看是否仍然发生相同的错误。该错误表明,您在随后的两次调查之间花费了太多时间,因此这可能会解决您的问题。另外,请提及您使用的Kafka版本。 Kafka在0.10版之前具有不同的心跳管理策略,这可能会使此问题更容易重现。