How to start multiple instances of kafka broker in windows ?
Kafka is a distributed streaming platform and used effectively to publish and subscribe the streams of messages. So knowing how to start multiple instances of the kafka is a must to know stuff.
Table of Contents
Create multiple server.properties as per your need
You can see server.properties file inside your config folder, You are new to kafka and need help to setup/install kafka on your machine, then feel free to go through this link.
Now I would like to create 2 more kafka brokers, so replicating the server.properties twice,
Lets change the configurations in the server.properties files
Configurations to be changed:
- broker.id
- log.dirs
- listeners (basically the port)
Changing the broker.id
Changing the log.dirs path
Changing the listeners port
Start multiple brokers now
Starting broker 0 with server.properties
kafka-server-start.bat ..\..\config\server-1.properties
Starting broker 1 with server-1.properties
kafka-server-start.bat ..\..\config\server-1.properties
Starting broker 2 with server-2.properties
kafka-server-start.bat ..\..\config\server-2.properties
Command to get the running brokers ids from the cluster through zookeeper
zookeeper-shell.bat localhost:2181 ls /brokers/ids
0,1,2 – kafka broker id’s we have configured in the server.properties, server-1.properties and server-2.properties respectively.
Command to get more details about the particular kafka broker
pass: 0/1/2 here
zookeeper-shell.bat localhost:2181 ls /brokers/ids/2