Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to connect broker - kafka Tool

Tags:

apache-kafka

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

like image 761
Indrajeet Gour Avatar asked Aug 09 '18 11:08

Indrajeet Gour


People also ask

Why I Cannot connect to Kafka from outside?

Typically, this should return the real ip of the host. However, sometimes (e.g., in EC2), the returned ip is an internal one and can't be connected to from outside. The solution is to explicitly set the host ip and port to be registered in ZK by setting the advertised.

What happens when a Kafka broker fails?

If any broker fails, data should not be lost. For fault-tolerance purposes, the partition is replicated and stored in different brokers. If leader brokers fail, then the controller will elects one of the replicas as the leader.

Why is my Kafka tool not connecting to zookeeper?

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.

Can Kafka broker run on another machine?

Now let’s check the connection to a Kafka broker running on another machine. This could be a machine on your local network, or perhaps running on cloud infrastructure such as Amazon Web Services (AWS), Microsoft Azure, or Google Cloud Platform (GCP).

How do Kafka clients work with Kafka clusters?

On one is our client, and on the other is our Kafka cluster’s single broker (forget for a moment that Kafka clusters usually have a minimum of three brokers). The client initiates a connection to the bootstrap server (s), which is one (or more) of the brokers on the cluster.

How do I set up SSL for Kafka brokers?

If your Kafka cluster is configured to use SSL you may need to set various SSL configuration parameters. Unless your Kafka brokers are using a server certificate issued by a public CA, you need to point to a local truststore that contains the self signed root certificate that signed your brokers certificate.


3 Answers

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.

like image 87
Tshepo Mgaga Avatar answered Sep 28 '22 08:09

Tshepo Mgaga


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

like image 36
Gth lala Avatar answered Sep 28 '22 09:09

Gth lala


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
...
like image 20
Tejash JL Avatar answered Sep 28 '22 10:09

Tejash JL