In this post , we will see - How to Setup Multi Node Kafka Cluster or Brokers ? As we all know the Real strength and True purpose of Kafka System is inculcated in a Multi Node setup. An multi node Kafka Architecture takes care of Data Replication and Safety as well as efficient Topic Partitions.
Let us follow the below steps to start a Multi node Kafka Cluster or Broker system . For this case we will create a 3-Node Kafka Cluster. Our system Cluster comprises of 3 nodes -
\# list of servers
server.<Node1\_UNIQUE\_ID\_1>=0.0.0.0:2888:3888
server.<Node2\_UNIQUE\_ID\_2>=<Ip of Broker B>:2888:3888
server.<Node3\_UNIQUE\_ID\_3>=<ip of Broker C>:2888:3888
Note the Unique Id details following server. parameter. It is very important that this id is Unique across all the 3-Nodes in the Cluster.
\# list of servers
server.<Node1\_UNIQUE\_ID\_1>=<ip of Broker A>:3888
server.<Node2\_UNIQUE\_ID\_2>=0.0.0.0:2888:3888
server.<Node3\_UNIQUE\_ID\_3>=<ip of Broker B>:2888:3888
\# list of servers
server.<Node1\_UNIQUE\_ID\_1>=<ip of Broker A>:2888:3888
server.<Node2\_UNIQUE\_ID\_2>=<Ip of Broker B>:2888:3888
server.<Node3\_UNIQUE\_ID\_3>=0.0.0.0:2888:3888
If you have even more Nodes or Servers in your cluster , you can follow and repeat the similar steps for them as well Step 3: Kafka Configuration
cd /usr/Kafka/config
broker.id=1 \-----> THIS SHOULD BE UNIQUE FOR EACH BROKER
\# add all 3 zookeeper instances ip here
zookeeper.connect=<BrokerA\_IP>:2181,<BrokerB\_IP>:2181,<BrokerC\_IP>:2181
Within that file , change the below -
broker.id=2 -----> THIS SHOULD BE UNIQUE FOR EACH BROKER
# add all 3 zookeeper instances ip here
zookeeper.connect=<BrokerA\_IP>:2181,<BrokerB\_IP>:2181,<BrokerC\_IP>:2181
Within that file , change the below -
broker.id=3 -----> THIS SHOULD BE UNIQUE FOR EACH BROKER
# add all 3 zookeeper instances ip here
zookeeper.connect=<BrokerA\_IP>:2181,<BrokerB\_IP>:2181,<BrokerC\_IP>:2181
Step 4: Start the Zookeeper & Kafka
cd ~/kafka
$ bin/zookeeper-server-start.sh ~/config/zookeeper.properties
$ bin/kafka-server-start.sh ~/config/server.properties
cd ~/kafka
$ bin/zookeeper-server-start.sh ~/config/zookeeper.properties
$ bin/kafka-server-start.sh ~/config/server.properties
cd ~/kafka
$ bin/zookeeper-server-start.sh ~/config/zookeeper.properties
$ bin/kafka-server-start.sh ~/config/server.properties
Hope this helps to set-up a Multi node Kafka Cluster or Broker system. Other Reads -