Vaishali Gojra
Vaishali Gojra

Reputation: 79

Connection to node -1 could not be established. Broker may not be available

I am using confluent-5.1.1 and I want to use kafka and zookeeper. The servers are working fine but kafka log shows the following error

ERROR [Producer clientId=confluent-metrics-reporter] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available 

I have already made changes to server.properties and zookeeper.properties. Are there any other changes to be made I am using 2 nodes and instead of local host I am using my own IP. Can someone please tell what changes I need to perform to other files to remove error

Upvotes: 2

Views: 15818

Answers (2)

Divya J
Divya J

Reputation: 495

I was having same issue where everything works fine but still I get this error. I backtracked my changes surrounding the Kafka initial set up and figured out below are steps that needs to be taken to fix this issue

  1. Make sure that your JDK is installed correctly. I exactly had this issue because the JDK path/JAVA_HOME path that I was pointing to in my environment variables was incorrect due to which even when the broker started it was not detected by the Client. Even if required, I suggest to install the JDK again correctly to avoid this issue.

  2. If then also nothing works out, then go for

#listeners=PLAINTEXT://:9092 changed this to

listeners=PLAINTEXT://127.0.0.1:9092

or

listeners=PLAINTEXT://localhost:9092

please note : If you see that your broker started and having issue , highly likely you will be seeing the dumps getting created in your kafka\bin\windows location

Upvotes: 1

Robin Moffatt
Robin Moffatt

Reputation: 32130

See the following references for how to set up Kafka across multiple nodes:

Upvotes: 0

Related Questions