Leader brokers without a matching listener error in kafka

[2018-08-22 11:40:49,429] WARN [Consumer clientId=consumer-1, groupId=console-consumer-62114] 1 partitions have leader brokers without a matching listener, including [topicname-0] (org.apache.kafka.clients.NetworkClient)

This error also happens if you try to run multiple consumers and the kafka topic contains only one partition. Generally one consumer should mapped with one partition. If you are using two consumers then you should have 2 partition in the kafka topic.


In my case, i was getting this error when i was testing Kafka fail-over. I brought down 1 Kafka, and expected the message to be written to the other Kafka.

The issue was that topic replication-factor was set to 1, when i needed to set it to 2. (2 Kafka instances)

Bonus:
Check out the directories where the topics are created(in my case: kafka-logs-xx) for both Kafka, and you will understand why :-)