DevOps | Cloud | Analytics | Open Source | Programming





How To Fix - Cluster Configuration Issue in Kafka ?



In this post we will discuss How To Fix - Kafka Cluster Configuration Issue in Kafka. Sometimes Kafka clustering gives setup issue.Lets say you have a Kafka Cluster with five brokers and one zookeeper.  Suppose the replication factor and partition is two. And you see messages like below in the terminal -



Turned off nodeA and nodeB
Turned on nodeA
Turned off nodeA
Turned on nodeB


The node B fails and subsequently the consumer pops below error messages -



Connection to node A (/nodeA\_ip\_address) could not be established. Broker may not be available


Lets say both the Producer & Consumer are Spring boot applications. To fix this issue , try the below steps and see how they goes -

  • Add all the bootstrap servers to the below -


config. listeners=PLAINTEXT://NodeA\_ip\_address:9092,NodeB\_ip\_address:9092 etc.


  • Add all broker addresses to bootstrap.servers properties in both Kafka Producer and Consumer config files
 

  • Update the application.property file as shown below -


spring.kafka.bootstrap-servers=NodeA\_ip\_address:9092,NodeB\_ip\_address:9092


Hope this helps.  

Additional Read -