大家好,我是邵奈一,一个不务正业的程序猿、正儿八经的斜杠青年。
1、世人称我为:被代码耽误的诗人、没天赋的书法家、五音不全的歌手、专业跑龙套演员、不合格的运动员…
2、这几年,我整理了很多IT技术相关的教程给大家,主要是大数据教程,帮助了很多小伙伴入坑大数据行业。

报错如下:

java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for mySecondTopic-2:120000 ms has passed since batch creation
at org.apache.kafka.clients.producer.internals.FutureRecordMetadata.valueOrError(FutureRecordMetadata.java:98)
at org.apache.kafka.clients.producer.internals.FutureRecordMetadata.get(FutureRecordMetadata.java:67)
at org.apache.kafka.clients.producer.internals.FutureRecordMetadata.get(FutureRecordMetadata.java:30)
at com.shaonaiyi.producer.MySecondProducer.main(MySecondProducer.java:31)
Caused by: org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for mySecondTopic-2:120000 ms has passed since batch creation

Process finished with exit code 0
org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for mySecondTopic-2:120000 ms has passed since batch creation

Process finished with exit code 0

原因:Java API 方式生成者无法与Kafka连接

情况说明:


1、Kafka版本:​​kafka_2.12-2.3.0​​ 2、部署方式为伪分布式,在一台机器上配置了三个server.properties文件


解决方案:

在每个server.properties文件里面添加一句:

host.name=服务器的ip;

因为我在服务器上配置了域名映射,所以我配的是

host.name=主机名

问题解决!