org.apache.kafka.common.errors.TimeoutException

个人博客地址:org.apache.kafka.common.errors.TimeoutException | 一张假钞的真实世界

使用kafka-console-producer.sh向远端Kafka写入数据时遇到以下错误:

复制代码
$ bin/kafka-console-producer.sh --broker-list 172.16.72.202:9092 --topic test
This is a message
[2017-08-24 11:47:48,286] ERROR Error when sending message to topic test with key: null, value: 17 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for test-0: 1523 ms has passed since batch creation plus linger time
八月 24, 2017 11:50:55 上午 sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAcceptLoop
警告: RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,localport=38175] throws
java.io.IOException: The server sockets created using the LocalRMIServerSocketFactory only accept connections from clients running on the host where the RMI remote objects have been exported.
	at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(LocalRMIServerSocketFactory.java:114)
	at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:400)
	at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:372)
 	at java.lang.Thread.run(Thread.java:748)

在没有配置advertised.host.name的情况下,Kafka并没有广播我们配置的host.name,而是广播了主机配置的hostname。远端的客户端并没有配置hosts,所以自然是连接不上这个hostname的,所以在远端客户端配置hosts。在客户端/etc/hosts中添加以下内容后问题解决:

复制代码
172.16.72.202 172-16-72-202
相关推荐
DemonAvenger2 天前
Kafka性能调优:从参数配置到硬件选择的全方位指南
性能优化·kafka·消息队列
初次攀爬者3 天前
ZooKeeper 实现分布式锁的两种方式
分布式·后端·zookeeper
yumgpkpm4 天前
AI视频生成:Wan 2.2(阿里通义万相)在华为昇腾下的部署?
人工智能·hadoop·elasticsearch·zookeeper·flink·kafka·cloudera
予枫的编程笔记4 天前
【Kafka高级篇】避开Kafka原生重试坑,Java业务端自建DLQ体系,让消息不丢失、不积压
java·kafka·死信队列·消息中间件·消息重试·dlq·java业务开发
倚肆4 天前
在 Windows Docker 中安装 Kafka 并映射 Windows 端口
docker·kafka
james的分享4 天前
大数据领域核心 SQL 优化框架Apache Calcite介绍
大数据·sql·apache·calcite
断手当码农4 天前
Redis 实现分布式锁的三种方式
数据库·redis·分布式
莫寒清4 天前
Apache Tika
java·人工智能·spring·apache·知识图谱
Sheffield4 天前
如果把ZooKeeper按字面意思比作动物园管理员……
elasticsearch·zookeeper·kafka