Public | Automated Build

Last pushed: 2 years ago
Short Description
A docker image that contains kafka and zookeeper with properties to allow multi host clustering
Full Description

Kafka / Zookeeper Docker Image

This is a java 8 image that contains kafka and zookeeper it has been designed to allow the simple setup and config of a multi host ensemble (cluster)

To build the image yourself run the following command # (Note the trailing dot!)

docker build -t krisdavison/kafka-zookeeper-cluster .

The github repo contains a sample docker-compose file showing how to spin up a three node cluster and kafka-manager for monitoring.
Below is a example of each node and a description of what the fields are for.

  image: krisdavison/kafka-zookeeper-cluster
  hostname: zoo1                    # internal docker container hostname
  extra_hosts:                        # host names of the other docker containers in the cluster and the ip of the box they run on. 
    - "zoo2:"
    - "zoo3:"
    - "2181:2181"                    # public zookeeper port mapping to container
    - "9092:9092"                    # public kafka port mapping to container
    - "2888:2888"                    # port used by zookeeper to maintain the ensemble (cluster) 
    - "3888:3888"                    # port used by zookeeper to maintain the ensemble (cluster) 
    NODE_ID: 1                        # ID of the node in the cluster (idealy 1 to ... however many nodes you have )
    ZOOKEEPER_NODES:,,                     # list of zookeeper nodes with internal ensemble ports
    KAFA_ADVERTISED_NODES: PLAINTEXT://,PLAINTEXT://,PLAINTEXT://       # list of kafka nodes with public kafka port
    KAFKA_CONNECT:,,                            # list of zookeeper nodes with public port (used by kafka to connect)

To run the docker compose file use the following command

docker-compose -p kaf -f docker-compose-cluster.yml up -d

BUT remember you will have to create a different docker-compose file for each node in your cluster - the included one is for reference only and assumes alot about ip addresses etc.

Docker Pull Command