apache-kafkaapache-zookeeper

Setting up Apache Kafka Cluster


I've been experimenting with Apache Kafka, the distributed streaming platform, but I'm having difficulties with the "distributed" aspect of it.

I'm using the example here, which works fine when everything is on the same machine. But I wanna run it as a cluster with 2 or more VMs

What I managed to do so far:

What I want to do:

Configure my Kafka in a way that allows me to run 2 or more brokers on different VMs as a cluster.

My setup:


Solution

  • It took me some time to find the solution since most tutorials stop short of the clustering part or showcase it on one single machine instead of several ones:

    All that needs to be done is adding this line to config/server.properties:

    listeners=PLAINTEXT://192.168.56.101:9092 # for broker.id=0
    listeners=PLAINTEXT://192.168.56.102:9092 # for broker.id=1