具体报错:[Producer clientId=console-producer] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
使用的指令:
之后输入数据回车报错
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic clicks
看了下相关配置文件文章来源:https://www.toymoban.com/news/detail-523890.html
[root@master kafka]# cat config/server.properties | grep 9092
# listeners = PLAINTEXT://your.host.name:9092
#listeners=PLAINTEXT://:9092
listeners=PLAINTEXT://master:9092
#advertised.listeners=PLAINTEXT://your.host.name:9092
[root@master kafka]# pwd
/export/server/kafka
[root@master kafka]#
从上述结果来看,是报错和配置里面的地址有关系,只需要改用配置里的hostname启动就好了文章来源地址https://www.toymoban.com/news/detail-523890.html
./bin/kafka-console-producer.sh --broker-list master:9092 --topic clicks
到了这里,关于kafka报错: (localhost/127.0.0.1:9092) could not be established. Broker may not be available.的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!