Skip to content

Latest commit

 

History

History

zookeeper

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Zookeeper

This project provides several useful Docker-Compose script to help quickly bootup a Zookeeper cluster.

Currently we support Zookeeper 3.5.6.*.

TBD

Start

$ docker-compose up -d

Test

Open a new shell to the cli container:

$ docker exec -it cli bash

In the container shell, create a new topic and wait for new msg (dir default to KAFKA_HOME=/opt/kafka/).

# pwd
/opt/kafka

# bash /tmp/topic_create.sh
Create a topic test by connecting to zookeeper
Created topic test
bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 1 --topic test
Created topic test.

# bash /tmp/topic_list.sh
List all topics at zookeeper
bin/kafka-topics.sh --list --zookeeper zookeeper:2181
test

# export KAFKA_HOST=kafka1
# bash /tmp/msg_recv.sh
Recving msg to topic test by connecting to kafka1
bin/kafka-console-consumer.sh --bootstrap-server kafka1:9092 --topic test --from-beginning

Now open a new shell to the cli container.

# export KAFKA_HOST=kafka2
# bash /tmp/msg_send.sh
Send msg to topic test by connecting to kafka2
bin/kafka-console-producer.sh --broker-list kafka2:9092 --topic test
>msg_hello

Check the recving msg shell to get that msg.

Stop

$ docker-compose down