kafka Failed to send messages after 3 tries 问题解决
kafka Failed to send messages after 3 tries.
在kafka0.8开发过程中 生产者测试用例碰到了
Exception in thread "main" kafka.common.FailedToSendMessageException: Failed to send messages after 3 tries.
at kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:90)
at kafka.producer.Producer.send(Producer.scala:76)
at kafka.javaapi.producer.Producer.send(Producer.scala:33)
at com.tuan55.kafka.test.TestP.main(TestP.java:20)
这样的错误。
起初以为是网络问题,经确认网络没有问题。
Properties props = new Properties();
props.put("metadata.broker.list", "xx.xx.xx.xx:9092");
props.put("serializer.class", "kafka.serializer.StringEncoder");
props.put("request.required.acks", "1");
ProducerConfig config = new ProducerConfig(props);
Producer<String, String> producer = new Producer<String, String>(config);
KeyedMessage<String, String> km = new KeyedMessage<String, String>("mm", "key-1", "content-1-中文");
producer.send(km);
producer.close();
这是生产者的代码 在向服务器发起连接后,在kafka的服务器配置中有zookeeper.connect=xx.xx.xx.xx:2181的配置 这时候kafka会查找zookeeper
那么如果我们的hosts 中没有做hosts的配置 kafka经多次尝试连接不上就会报上面的错误。
解决办法:配置hosts文件 做zookeeper服务器的映射配置。
出现此种错误 还有一种情况
# Hostname the broker will advertise to producers and consumers. If not set, it uses the
# value for "host.name" if configured. Otherwise, it will use the value returned from
# java.net.InetAddress.getCanonicalHostName().
advertised.host.name=192.168.1.118
远程连接的话 是根据这个配置来找broker的,默认是localhost ,所以如果不是本机运行的话 应该设置此值 来确保通信畅通。
kafka Failed to send messages after 3 tries 问题解决的更多相关文章
- 开发环境解决 kafka Failed to send messages after 3 tries
新建了一个kafka集群,在window下写了一个简单的producer做测试,结果遇到了消息发送失败的问题,代码如下: Properties props = new Properties(); pr ...
- kafka.common.FailedToSendMessageException: Failed to send messages after 3 tries.
今天在写kafka生产者生成数据的程序并运行时,报如下错误: log4j:WARN No appenders could be found for logger (kafka.utils.Verifi ...
- kafka.common.FailedToSendMessageException: Failed to send messages after 3 tries. 最无语的配置
注意: 本文不谈废话,低级问题请自行检查. 我使用Java版本的Kafka Producer生产数据,但是抛出了这个异常.百思不得其解,明明防火墙配置,ZooKeeper,Kafka配置都是没问题的啊 ...
- Thread-0" kafka.common.FailedToSendMessageException: Failed to send messages after 3 tries.
http://blog.csdn.net/jingshuigg/article/details/25001979 zookeeper.connect=localhost:2181改成zookeeper ...
- Caused by java.lang.Exception Failed to send data to Kafka Expiring
flink 写kafka,报错,作业挂掉 Caused by: java.lang.Exception: Failed to send data to Kafka: Expiring 89 recor ...
- lr11 BUG?Failed to send data by channels - post message failed.
问题描述 : http协议,场景运行一会之后,报错! erro信息: Failed to send data by channels - post message failed. 解决方法 :ht ...
- org.apache.flume.EventDeliveryException: NettyAvroRpcClient { host: hadoop1, port: 41414 }: Failed to send event
org.apache.flume.EventDeliveryException: NettyAvroRpcClient { host: hadoop1, port: 41414 }: Failed t ...
- windows elasticsearch搭集群启动失败failed to send join request to master....
创建几份elasticsearch副本,修改各自config\elasticsearch.yml配置文件: 第一份: #允许elasticsearch跨域访问,使用elasticsearch-head ...
- VirtualBox问题解决合集 - [drm:vmw_host_log [vmwgfx]] *ERROR* Failed to send host log message
转载:https://blog.csdn.net/mychangee/article/details/104954262 问题描述:[drm:vmw_host_log [vmwgfx]] ERROR ...
随机推荐
- 有史来最大改变 Android 5.0十大新特性
有史来最大改变 Android 5.0十大新特性 2014.10.16 14:51:31 来源:腾讯数码作者:腾讯数码 ( 0 条评论 ) 距离Android系统上一次重大更新不到一年的时间,谷歌 ...
- 深入分析@Transactional的用法
关键词:事务, 编程式事务,声明式事务.spring 事务管理.AOP事务增强.@Transactional 在分析深入分析@Transactional的使用之前,我们先回顾一下事务的一些基本内容. ...
- 后台拼接input 后,动态获取input的值
//前台 <input id=" /> //后台 string text = request.form["text"].toString();
- sql 动态行转列
create table u01 (医案编号 varchar(5),药物编号 varchar(5)) insert into u01 select '01','01' union all select ...
- 云虚拟主机开源 DedeCMS 安装指南
1. 获取主机 FTP 和 数据库 信息 1.1 FTP 信息 登录主机管理后台,在 站点信息 中获取到 FTP 和 数据库 的账号密码,连接地址. 如下图所示: 如果忘记密码,可以在这里进行 重置密 ...
- NIO的一些相关链接
Architecture of a Highly Scalable NIO-Based Server Scalable IO in Java Tricks and Tips with NIO part ...
- java实现a+b的多重输入
import java.util.Scanner; public class hello { public static void main(String[] args) { Scanner cin ...
- JAVA反编工具件安装 JD-eclipse
想看Android API源码,但是只有class文件,于是找了个反编译工具Java Decompiler,免费的反编译工具.eclipse插件:JD-eclipse. 安装步骤: 1.确保计算机上 ...
- bzoj2141排队(辣鸡但是好写的方法)
题意很明确,也非常经典: 一个支持查询 区间中比k大的数的个数 并且支持单点修改的序列 ——因为题意可以转化为:查询这两个数中比后者大的个数.比后者小的个数.比前者大的个数.比前者小的个数(根据这4个 ...
- /usr文件系统
/usr文件系统 /usr 文件系统经常很大,因为所有程序安装在这里. /usr 里的所有文件一般来自Linux distribution:本地安装的程序和其他东西在/usr/local 下.这样可 ...