Indrajeet Gour
Indrajeet Gour

Reputation: 4500

Unable to connect broker - kafka Tool

I am facing below error message when i was trying to connect and see the topic/consumer details of one of my kafka clusters we have.

we have 3 brokers in the cluster which I able to see but the topic and its partitions.

enter image description here

Note : I have kafka 1.0 and kafka tool version is 2.0.1

Upvotes: 9

Views: 32501

Answers (7)

Marcio Carolino
Marcio Carolino

Reputation: 1

add to the file server.properties

advertised.listeners=PLAINTEXT://localhost:9092

listeners=PLAINTEXT://0.0.0.0:9092

Upvotes: 0

grunt
grunt

Reputation: 712

When encountering problem on localhost: edit kafka/config/server.properties:

change zookeeper.connect from localhost to external IP of local host.

Upvotes: 0

Rajesh B
Rajesh B

Reputation: 61

To fix this issue, we need to change the server.properties file.

$ vim /usr/local/etc/kafka/server.properties

Here update the listeners value from

listeners=PLAINTEXT://:9092

to

listeners=PLAINTEXT://localhost:9092

source:https://medium.com/@Ankitthakur/apache-kafka-installation-on-mac-using-homebrew-a367cdefd273

Upvotes: 5

Indrajeet Gour
Indrajeet Gour

Reputation: 4500

For better visibility (even already commented the same in early days thread)

In my case, I got to know when I used Kafkatool from my local machine, tool tris to find out Kafka broker port which was blocked from my cluster admins for my local machine, that is the reason I was not able to connect.

Resolution:

Either ask the admin to open the port for intranet if they can, if they can not you can use tunnelling for your testing purpose or time being for your port.

Hope this would help a few.

Upvotes: 1

Tejash JL
Tejash JL

Reputation: 396

This issue occurs if you have not set listeners and advertised.listeners property in server.properties file.

For Ex: config/server.properties

...
listeners=PLAINTEXT://:9092
...
advertised.listeners=PLAINTEXT://<public-ip/host-name>:9092
...

Upvotes: 3

Tshepo Mgaga
Tshepo Mgaga

Reputation: 272

I had the same issue on my MacBook Pro. The tool was using "tshepo-mbp" as the hostname which it could not resolve. To get it to work I added 127.0.0.1 tshepo-mbp to the /etc/hosts file.

Upvotes: 8

Gth lala
Gth lala

Reputation: 322

kafka tool is most likely using the hostname to connect to the broker and cannot reach it. You maybe connecting to the zookeeper host by IP address but make sure you can connect/ping the host name of the broker from the machine running the kafka tool.

If you cannot ping the broker either fix the network issues or as a workaround edit the host file on your client to let it know how to reach the broker by its name

Upvotes: 5

Related Questions