Kafka 的消费组时不时就会断开连接

本文分析了Kafka消费组断开连接的原因,包括一个topic多个consumer导致的rebalancing和consumer poll超时。解决方案是调整Kafka参数如max.poll.records和max.poll.interval.ms,以及优化消费逻辑,确保消费速度与poll间隔匹配。

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

问题现象

Kafka消费组时不时就会断开连接1,提示如下异常

2019-19-28 12:36:44.711 |-INFO  [kafka-coordinator-heartbeat-thread | loongshawn] org.apache.kafka.clients.consumer.internals.AbstractCoordinator [1234] -| [Consumer clientId=loongshawn-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx-127.0.0.1, groupId=loongshawn] Member loongshawn-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx-127.0.0.1 sending LeaveGroup request to coordinator xx.xx.xx.xx:9092 (id: 23456223346 rack: null) due to consumer poll timeout has expired. This means 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 processing messages. You can address this either by increasing max.poll.interval.ms or by reducing the maximum size o

2019-19-28 12:36:44.711 |-INFO [kafka-coordinator-heartbeat-thread | loongshawn] org.apache.kafka.clients.consumer.internals.AbstractCoordinator [1234] -| [Consumer clientId=loongshawn-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx-127.0.0.1, groupId=loongshawn] Member loongshawn-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx-127.0.0.1 sending LeaveGroup request to coordinator xx.xx.xx.xx:9092 (id: 23456223346 rack: null) due to consumer poll tim

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值