Kafka multi broker cluster setup on windows 10


Kafka multi broker cluster setup on windows 10 tutorial shows step by step how to setup apache kafka multi broker cluster on wirdows 10.

In order to know how to install and setup a single broker cluster on windows, you should check this apache kafka install tutorial.

Create Apache Kafka configurations for two brokers

We should duplicate the file config/server.properties two times to create the configurations of the two brokers. In order to do that, we execute these commands :

copy config/server.properties config/server-1.properties
copy config/server.properties config/server-2.properties 

Then, we change the following properties of the two files to be the followings :

config/server-1.properties:

  • broker.id=1
  • listeners=PLAINTEXT://:9093
  • log.dir=/tmp/kafka-logs-1

config/server-2.properties:

  • broker.id=2
  • listeners=PLAINTEXT://:9094
  • log.dir=/tmp/kafka-logs-2

Startup the tree Apache Kafka nodes

Before starting apache kafka, you should startup the Zookeeper like what is explained in this apache kafka install tutorial.

Then, you can start the three kafka brokers using these commands 
bin/windows/kafka-server-start.bat config/server.properties
bin/windows/kafka-server-start.bat config/server-1.properties
bin/windows/kafka-server-start.bat config/server-2.properties

In fact, you should run each command in a separate terminal.

Create new topic replicated to all 3 brokers

Creating apache kafka topic

In order to create an apache Kafka topic, you should run this command :

bin/windows/kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 3 --partitions 1 --topic replicated-topic

This command creates a topic called replicated-topic that we will use to send and receive messages.

Visualizing apache kafka topic

We can visualize apache kafka topic using this command :

bin/windows/kafka-topics.sh --describe --zookeeper localhost:2181 --topic replicated-topic 

In order to check how to produce and consume messages, please check this apache kafka setup tutorial.

Conclusion

This Kafka multi broker cluster setup on windows 10 tutorial arrives at its end.

You may check also our core java tutorial to learn core java from scratch. Please keep tuned because we will release more tutorials about apache kafka and java microservices.

In order to get our latest updates, please feel free to like our how to program facebook page.


Post a Comment

Previous Post Next Post