springboot集成kafka发消息报Exception thrown when sending a message with key= and payload='1' to topic test

本地环境 springboot集成kafka发消息报错Exception thrown when sending a message with key='' and payload='1' to topic test

org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for test-0 due to 30049 ms has passed since batch creation plus linger time


错误排查:

  1.     服务器防火墙已关闭,本地telnet连接9092端口没问题
  2.     kafka配置文件 listeners=PLAINTEXT://{内网ip}:9092
  3.     将项目日志级别调制DEBUG 发现启动过程报错  
Connection with /{内网ip} disconnected
java.net.ConnectException: Connection timed out: no further information 
Initiating connection to node 0 at {内网ip}:9092.

由此可见错误原因是本地无法访问服务器内网ip导致


解决办法:

修改kafka配置文件server.properties

listeners=PLAINTEXT://{内网ip}:9092

advertised.listeners=PLAINTEXT://{外网ip}:9092

重新启动本地项目,发送消息成功,并且DEBUG 日志级别下会打印心跳日志

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值