ERROR Error when sending message to topic test with key: null, value: 0 bytes with error: 错误解决

错误信息

[root@name1 kafka_2.11-0.10.0.1]# bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
hello
[2018-09-26 13:45:55,088] ERROR Error when sending message to topic test with key: null, value: 5 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 test-0

原先使用的是0.8.1.1版本的kafka,换成0.10.0.1版本的kafka之后,仍然使用之前创建的topic  test,就会一直出现这个错误。

当我使用新版本的kafka创建一个新的topic,进行测试,发现问题就没有了。

判定是两个版本的topic不能通用,代码可能实现不一致导致的。

mark一下,如果有了解更多的,希望留言。

你可能感兴趣的:(kafka)