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


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。

时间: 2024-10-24 16:41:23

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

大数据技术之_10_Kafka学习_Kafka概述+Kafka集群部署+Kafka工作流程分析+Kafka API实战+Kafka Producer拦截器+Kafka Streams

第1章 Kafka概述1.1 消息队列1.2 为什么需要消息队列1.3 什么是Kafka1.4 Kafka架构第2章 Kafka集群部署2.1 环境准备2.1.1 集群规划2.1.2 jar包下载2.2 Kafka集群部署2.3 Kafka命令行操作第3章 Kafka工作流程分析3.1 Kafka 生产过程分析3.1.1 写入方式3.1.2 分区(Partition)3.1.3 副本(Replication)3.1.4 写入流程3.2 Broker 保存消息3.2.1 存储方式3.2.2 存储策

kafka producer consumer

package demo; import java.util.Properties; import kafka.javaapi.producer.Producer; import kafka.producer.KeyedMessage; import kafka.producer.ProducerConfig; public class producer { private final Producer<String, String> producer; public final static

Flink kafka producer with transaction support

Background In flink 1.5 above, it provides a new kafka producer implementation: FlinkKafkaProducer011, aligning with kafka 0.11 above that supports transaction. Kafka transaction allows multiple kafka messages sent by producer to deliver in an atomic

spring kafka producer 生产者

pom引入jar包 ··· org.springframework.kafka spring-kafka 1.1.1.RELEASE ··· ### spring配置 ``` ``` ### kafka.properties 配置文件 ``` kafka.producer.servers=127.0.0.1:9091,127.0.0.1:9092 kafka.producer.retries=1 kafka.producer.batch.size=4096 kafka.producer.ling

Failed to send producer request with correlation id 2 to broker 0 with

部署Flume在Window环境中,Kafka部署在Linux上,从Flume发送事件到Kafka始终有一下错误, 经过长时间在网上搜索终于把问题解决, 修改kafka中配置项, #advertised.host.name=<hostname routable by clients> 注释去掉,并配置上kafka所在linux的ip地址 advertised.host.name=192.168.10.10 重启kafka. 2016-04-16 16:43:34,069 (SinkRunner

【转】Kafka producer原理 (Scala版同步producer)

转载自:http://www.cnblogs.com/huxi2b/p/4583249.html     供参考 本文分析的Kafka代码为kafka-0.8.2.1.另外,由于Kafka目前提供了两套Producer代码,一套是Scala版的旧版本:一套是Java版的新版本.虽然Kafka社区极力推荐大家使用Java版本的producer,但目前很多已有的程序还是调用了Scala版的API.今天我们就分析一下旧版producer的代码. producer还分为同步和异步模式,由属性produc

【原创】Kafka producer原理 (Scala版同步producer)

本文分析的Kafka代码为kafka-0.8.2.1.另外,由于Kafka目前提供了两套Producer代码,一套是Scala版的旧版本:一套是Java版的新版本.虽然Kafka社区极力推荐大家使用Java版本的producer,但目前很多已有的程序还是调用了Scala版的API.今天我们就分析一下旧版producer的代码. producer还分为同步和异步模式,由属性producer.type指定,默认是sync,即同步发送模式.本文也主要关注于同步发送的代码走读.下面以console-pr

Flink生产数据到Kafka频繁出现事务失效导致任务重启

在生产中需要将一些数据发到kafka,而且需要做到EXACTLY_ONCE,kafka使用的版本为1.1.0,flink的版本为1.8.0,但是会很经常因为提交事务引起错误,甚至导致任务重启 kafka producer的配置如下 def getKafkaProducer(kafkaAddr: String, targetTopicName: String, kafkaProducersPoolSize: Int): FlinkKafkaProducer[String] = { val prop

kafka producer源码

producer接口: /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this