Search code examples
apache-kafkakafkajs

How to have multiple Kafka brokers replication


So I'm new to kafka, and I have trouble finding informations on having multiple kafka instances in order to have my message service still up if a broker instance goes down.

I've made a little local demo with Kafka JS and I've seen that we declare our brokers with an array like

const kafka = new Kafka({
  clientId: 'my-app',
  brokers: ['localhost:9092']
})

So my question is how to have X instances of my kafka broker that are synchronised trough messages but using different storages / instances / server (not sure what the appropriate word is here) ?

Many thanks ! Kev


Solution

  • You need to set up a Kafka cluster. There is no short answer on how to do it. I recommend you to look for an article on how to do it. For example this one: How to Setup a Kafka Cluster