码迷,mamicode.com
首页 > Web开发 > 详细

kafka producer生产数据到kafka异常:Got error produce response with correlation id 16 on topic-partition...Error: NETWORK_EXCEPTION

时间:2017-09-13 17:14:19      阅读:910      评论:0      收藏:0      [点我收藏+]

标签:技术   war   end   exception   containe   top   而不是   div   row   

 

kafka producer生产数据到kafka异常:Got error produce response with correlation id 16 on topic-partition...Error: NETWORK_EXCEPTION

1.问题描述

2017-09-13 15:11:30.656 o.a.k.c.p.i.Sender [WARN] Got error produce response with correlation id 25 on topic-partition test2-rtb-camp-pc-hz-5, retrying (299 attempts left). Error: NETWORK_EXCEPTION
2017-09-13 15:11:30.656 o.a.k.c.p.i.Sender [WARN] Got error produce response with correlation id 25 on topic-partition test2-rtb-camp-pc-hz-23, retrying (299 attempts left). Error: NETWORK_EXCEPTION
2017-09-13 15:11:30.657 o.a.k.c.p.i.Sender [WARN] Got error produce response with correlation id 25 on topic-partition test2-rtb-camp-pc-hz-14, retrying (299 attempts left). Error: NETWORK_EXCEPTION
2017-09-13 15:11:30.657 o.a.k.c.p.i.Sender [WARN] Got error produce response with correlation id 16 on topic-partition test2-rtb-camp-pc-hz-5, retrying (299 attempts left). Error: NETWORK_EXCEPTION
 
 

2.问题原因

$KAFKA_HOME/config/server.properties中有如下注释:
技术分享
大意是:kafka中每台broker会将hostname和port通知生产者和消费者,如果配置了listeners他就返回listeners的值,否则,就会调用java.net.InetAddress.getCanonicalHostName(),而这个方法返回的是linux这台主机的hostname,而不是IP。所以,在搭建kafka的时候需要配置listeners这个参数,最好也配上host.name=ip。

kafka producer生产数据到kafka异常:Got error produce response with correlation id 16 on topic-partition...Error: NETWORK_EXCEPTION

标签:技术   war   end   exception   containe   top   而不是   div   row   

原文地址:http://www.cnblogs.com/haozhengfei/p/7515669.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!