Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kafka broker not available at starting

I set on a ubuntu node of a cluster a kafka 0.11.0.0 instance. Until some weeks ago everything worked fine, today I'm trying to starting it and I obtain this error after the boot:

[2017-09-11 16:21:13,894] INFO [Kafka Server 0], started (kafka.server.KafkaServer) [2017-09-11 16:21:18,998] WARN Connection to node 0 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2017-09-11 16:21:21,991] WARN Connection to node 0 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) ... and so on... 

My server.properties:

############################# Server Basics #############################  # The id of the broker. This must be set to a unique integer for each broker. broker.id=0  # Switch to enable topic deletion or not, default value is false delete.topic.enable=true  ############################# Socket Server Settings ##########################$  # The address the socket server listens on. It will get the value returned from # java.net.InetAddress.getCanonicalHostName() if not configured. #   FORMAT: #     listeners = listener_name://host_name:port #   EXAMPLE: #     listeners = PLAINTEXT://your.host.name:9092 #listeners=PLAINTEXT://9092  # Hostname and port the broker will advertise to producers and consumers. If no$ # it uses the value for "listeners" if configured.  Otherwise, it will use the $ # returned from java.net.InetAddress.getCanonicalHostName(). advertised.listeners=PLAINTEXT://hidden_ip:55091 

I edited advertised.listeners because there is a proxy to redirect requests to the broker. Anyway until some weeks ago everything worked fine...

My step to start kafka:

1- service zookeeper start  2- ./kafka_2.11-0.11.0.0/bin/kafka-server-start.sh ~/kafka_2.11-0.11.0.0/config/server.properties 

Any advises? Thank you

like image 680
Akinn Avatar asked Sep 11 '17 14:09

Akinn


People also ask

What happens when broker is down in Kafka?

During a broker outage, all partition replicas on the broker become unavailable, so the affected partitions' availability is determined by the existence and status of their other replicas. If a partition has no additional replicas, the partition becomes unavailable.

How do I check my Kafka broker status?

If you are looking for the Kafka cluster broker status, you can use zookeeper cli to find the details for each broker as given below: ls /brokers/ids returns the list of active brokers IDs on the cluster. get /brokers/ids/<id> returns the details of the broker with the given ID.

Can we start Kafka server without starting zookeeper?

However, you can install and run Kafka without Zookeeper. In this case, instead of storing all the metadata inside Zookeeper, all the Kafka configuration data will be stored as a separate partition within Kafka itself.


2 Answers

uncomment this line

listeners=PLAINTEXT://:9092

changed this to

listeners=PLAINTEXT://127.0.0.1:9092

like image 155
Vengatesh Subramaniyan Avatar answered Oct 02 '22 15:10

Vengatesh Subramaniyan


I also had the same issue...

So I start by asking Zookeeper some data

echo dump | nc localhost 2181 

I get back something like this

SessionTracker dump: Session Sets (3): 0 expire at Sun Dec 03 18:15:48 GST 2017: 0 expire at Sun Dec 03 18:15:51 GST 2017: 1 expire at Sun Dec 03 18:15:54 GST 2017: 0x1601c9a25190000 ephemeral nodes dump: Sessions with Ephemerals (1): 0x1601c9a25190000: /controller /brokers/ids/0 

I read this to mean that I have 1 Broker available - and it is has an id of 0.

So, lets find about that broker.

bin/zookeeper-shell.sh localhost:2181 <<< "get /brokers/ids/0" 

And I see

{"listener_security_protocol_map":{"PLAINTEXT":"PLAINTEXT"},"endpoints":["PLAINTEXT://192.168.1.220:9092"],"jmx_port":-1,"host":"192.168.1.220","timestamp":"1512308520781","port":9092,"version":4} cZxid = 0x69 ctime = Sun Dec 03 17:42:00 GST 2017 mZxid = 0x69 mtime = Sun Dec 03 17:42:00 GST 2017 pZxid = 0x69 cversion = 0 dataVersion = 0 aclVersion = 0 ephemeralOwner = 0x1601c9a25190000 dataLength = 196 numChildren = 0 

This rather startled me ... PLAINTEXT://192.168.1.220:9092, so when I changed my connect string to read

bin/kafka-console-producer.sh  --broker-list PLAINTEXT://192.168.1.220:9092  --topic test 

It all now worked.

Good luck !!

like image 35
Tim Seed Avatar answered Oct 02 '22 14:10

Tim Seed