kafka报错org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for topic_test
注:Nifi使用PublishKafka组件写数据到kafka时,处理方式雷同
1.控制台报错:
2019-02-19 10:36:06.868 ERROR 2272 --- [kafka-producer-network-thread | producer-1] o.s.k.support.LoggingProducerListener : Exception thrown when sending a message with key='867726031364401_1_1234567890' and payload='{"devType":"T2N8IV91SPK08_C2N8IRISTFW08_1","tenantId":"4OAHW01","Timestamp_CloudM2M":"2019-02-19 10:...' to topic IRT_Dev_Status_STD_Bin:
org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for IRT_Dev_Status_STD_Bin-52 due to 30030 ms has passed since batch creation plus linger time
2.使用kafka客户端自带的api生产消息报错如下:
[2019-02-19 16:10:08,951] ERROR Error when sending message to topic IRT_Dev_Status_STD_Bin with key: null, value: 0 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Batch containing 1 record(s) expired due to timeout while requesting metadata from brokers for IRT_Dev_Status_STD_Bin-60
[2019-02-19 16:10:10,663] ERROR Error when sending message to topic IRT_Dev_Status_STD_Bin with key: null, value: 0 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Batch containing 1 record(s) expired due to timeout while requesting metadata from brokers for IRT_Dev_Status_STD_Bin-45
10.69.69.28
3.解决思路:
3.1 在Java程序端开启debug,查看具体报错信息
spring boot 的设置方式是:
logging.level.root=debug
然后重启应用
发现后台在不停的刷错误
如下:
[图片]
3.2 发现有一台机器无法连接,于是查找端口设置,发现确实没有开放
4.解决办法
4.1 关闭防火墙,打通网路,问题解决
4.2 配置hosts,切记