'Kafka - Error while fetching metadata with correlation id - LEADER_NOT_AVAILABLE

I have setup Kafka cluster locally. Three broker's with properties :

broker.id=0
listeners=PLAINTEXT://:9092

broker.id=1
listeners=PLAINTEXT://:9091

broker.id=2
listeners=PLAINTEXT://:9090

Things were working fine but I am now getting error :

WARN Error while fetching metadata with correlation id 1 : {TRAIL_TOPIC=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)

I am also trying to write messages via Java based client & I am getting error : unable to fetch metadata in 6000ms.



Solution 1:[1]

I faced the same problem, it is because the topic does not exist and the configuration of broker auto.create.topics.enable by default is set to false. I was using bin/connect-standalone so I didn't specify topics I would use.

I changed this config to true and it solved my problem.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 BSMP