无法建立到节点 -1 的连接.经纪人可能不可用.(org.apache.kafka.clients.NetworkClient) [英] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

查看:26
本文介绍了无法建立到节点 -1 的连接.经纪人可能不可用.(org.apache.kafka.clients.NetworkClient)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 Kafka 并做了一些基本的测试.我可以使用 Kafka-broker/bin 文件夹下提供的脚本创建主题.

I have installed Kafka and doing some basic testing. I am able to create topics using scripts provided under Kafka-broker/bin folder.

但是当我试图在每次运行时生成低于 WARNing 的消息时.并且不会生成任何消息.请指教.

But when I am trying to produce message getting below WARNing every time I run this. And no message is getting generated. Please advice.

[root@node2 bin]# ./kafka-console-producer.sh --broker-list localhost:9092 --topic test_master
>testmsg1
    [2019-05-15 06:25:19,092] WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
    [2019-05-15 06:25:19,197] WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
    [2019-05-15 06:25:19,349] WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
    [2019-05-15 06:25:19,562] WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
    [2019-05-15 06:25:20,017] WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
    [2019-05-15 06:25:20,876] WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
    [2019-05-15 06:25:21,987] WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
    [2019-05-15 06:25:22,957] WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
    [2019-05-15 06:25:23,818] WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
    ^Corg.apache.kafka.common.KafkaException: Producer closed while send in progress
            at org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:826)
            at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:803)
            at kafka.tools.ConsoleProducer$.send(ConsoleProducer.scala:75)
            at kafka.tools.ConsoleProducer$.main(ConsoleProducer.scala:57)
            at kafka.tools.ConsoleProducer.main(ConsoleProducer.scala)
    Caused by: org.apache.kafka.common.KafkaException: Requested metadata update after close
            at org.apache.kafka.clients.Metadata.awaitUpdate(Metadata.java:188)
            at org.apache.kafka.clients.producer.KafkaProducer.waitOnMetadata(KafkaProducer.java:938)
            at org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:823)
            ... 4 more

推荐答案

打开集群中每个代理的 Server.xml 并进行以下更改

Open Server.xml of each broker of your cluster and make following changes

listeners=PLAINTEXT://:9092 更改为 listeners=PLAINTEXT://:9092

这篇关于无法建立到节点 -1 的连接.经纪人可能不可用.(org.apache.kafka.clients.NetworkClient)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆