0
votes

I am new to kafka, When I am trying to send messages to the topic I am getting below error. Can someone help me with this?

[2018-09-23 13:37:56,613] WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

1
Broker may not be available... Lots of reasons for this. Please verify that Kafka is actually running at the list of addresses you have in your code - OneCricketeer
Thanks for the response, Yes Kafka broker is running. Checked everything even in Kafka logs also didn't find anything wrong. - karthik
Running where? Which IP or hostname did you provide to connect to it? - OneCricketeer
I installed Kafka in google cloud as a single node, so I gave the same IP for the Kafka broker and tried to send messages from Kafka producer. - karthik
Did you open the Kafka port from Google to your network? Did you use the external IP address? - OneCricketeer

1 Answers

0
votes

If you're running Kafka in a cloud service, then you need to configure the listeners appropriately. Almost certainly your client is connecting to the broker, but in the metadata returned by the broker getting an interal IP for the cloud network, which your external client cannot access.

This article explains it all, and the solution: https://rmoff.net/2018/08/02/kafka-listeners-explained/