kafka創建topic失敗

本人初次接觸kakfa,創建topic後生產消息失敗,生產消息的命令為:

sh kafka-console-producer.sh --broker-list localhost:9092 --topic test

報錯日誌為:

[2018-03-06 21:58:24,978] 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: Failed to update metadata after 60000 ms.

>[2018-03-06 21:58:27,995] WARN Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient):

後來在網上翻閱資料得到的解決辦法為:

在server.properties文件中你的listeners=PLAINTEXT://localhost:9092;把生產消息的命令中的localhost:9092換成PLAINTEXT://localhost:9092,即可成功。

小白初次試水,具體原理有待學習,望各位大神指點迷津。

kafka創建topic失敗


分享到:


相關文章: