在springcloud集成kafka,发送消息时报错:
2018-08-15 16:01:34.159 [http-nio-8081-exec-1] INFO org.apache.kafka.common.utils.AppInfoParser - Kafka version : 0.10.1.1
2018-08-15 16:01:34.159 [http-nio-8081-exec-1] INFO org.apache.kafka.common.utils.AppInfoParser - Kafka commitId : f10ef2720b03b247
2018-08-15 16:01:36.189 [http-nio-8081-exec-5] INFO com.lolaage.kafka.KafkaSender - 发送消息:123456
2018-08-15 16:02:04.389 [kafka-producer-network-thread | producer-2] ERROR o.s.kafka.support.LoggingProducerListener - Exception thrown when sending a message with key='null' and payload='{-1, 1, 11, 99, 111, 110, 116, 101, 110, 116, 84, 121, 112, 101, 0, 0, 0, 18, 34, 97, 112, 112, 108,...' to topic messages:
org.apache.kafka.common.errors.TimeoutException: Expiring 2 record(s) for messages-0 due to 30012 ms has passed since batch creation plus linger time
网上说法:kafka服务器上没有配置host和名称相对应,或者kafka需要重启
经常尝试均不行,经检查日志,往上查找发现:
2018-08-15 16:01:00.438 [-C-1] INFO o.a.k.c.consumer.internals.AbstractCoordinator - Marking the coordinator nt_web1:9092 (id: 2147483647 rack: null) dead for group anonymous.6fce406b-0835-4acb-bc3a-dd4ae5ce1014
应该还是通过nt_web1查找不到服务器,
后在本地的host文件中配置,192.168.100.91 nt_web1。成功解决。。。。。。