Error sending fetch request (sessionId=INVALID, epoch=INITIAL) to node 0

1 背景

使用 kafka Java Client消费 kafka中的消息,但是消费不到消息,而且日志中打印如下信息

Error sending fetch request (sessionId=INVALID, epoch=INITIAL) to node 0: {}.

2 问题解决

解决问题的前提是 kafka集群的运行状态是正常的,而且kafka和消费者之间的网络是畅通的

增加如下配置

  properties.setProperty("session.timeout.ms","600000");
  properties.setProperty("request.timeout.ms","600000");

3 解决问题思路

首先要学会查看官网,官网才是有公信力的

Apache Kafka

The expected time between heartbeats to the group coordinator when using Kafka's group management facilities. Heartbeats are used to ensure that the worker's session stays active and to facilitate rebalancing when new members join or leave the group. The value must be set lower than session.timeout.ms, but typically should be set no higher than 1/3 of that value. It can be adjusted even lower to control the expected time for normal rebalances.

Type:int
Default:3000 (3 seconds)
Valid Values:
Importance:high

默认是45秒中会报超时,我将这个配置调整到了10分钟

   默认是30秒超时,我调整为30分钟

 

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值