docker-compose-files/kafka
Baohua Yang 495a6c87ef Fix cc pkg path with Go 1.14 2020-12-07 13:33:08 -08:00
..
Makefile Start 3 zk nodes 2020-01-30 15:26:40 -08:00
README.md Update docs 2020-03-12 16:04:40 -07:00
docker-compose.yaml Fix cc pkg path with Go 1.14 2020-12-07 13:33:08 -08:00

README.md

Kakfa

This project provides several useful Docker-Compose script to help quickly bootup a Kakfa network, and do simple testing with create topic, send&recv msg.

Currently we support Kakfa 2.13.*.

Start

$ make start

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