Skip to content

Instantly share code, notes, and snippets.

@BlackMaria
Last active March 11, 2017 16:12
Show Gist options
  • Save BlackMaria/e34cbf5d543888659ba7d3658e94b6a1 to your computer and use it in GitHub Desktop.
Save BlackMaria/e34cbf5d543888659ba7d3658e94b6a1 to your computer and use it in GitHub Desktop.
#!/bin/bash
# source for doc http://wurstmeister.github.io/kafka-docker/
#
# I personally suggest you create all of these containers, but for simplicity I show you how to use them by the author
#
YOUR_IP=192.168.1.2
git clone https://github.com/wurstmeister/kafka-docker
cd kafka-docker
perl -pi -e "s/192.168.99.100/${YOUR_IP}/g" docker-compose.yml
# Or to expose ZK use this instead
# perl -pi -e "s/192.168.99.100/${YOUR_IP}/g ; s/zookeeper:2181/${YOUR_IP}:2181/g" docker-compose.yml
docker-compose up -d
docker-compose scale kafka=2
# This script seems to do too much and could be replaced
./start-kafka-shell.sh ${YOUR_IP} ${YOUR_IP}:2181
# INSIDE CONTAINER
kafka-topics.sh --create --topic topic --partitions 4 --zookeeper $ZK --replication-factor 2
kafka-topics.sh --describe --topic topic --zookeeper $ZK
# I added this little test to show it worked
kafka-topics.sh --list --zookeeper $ZK
kafka-console-producer.sh --topic=topic --broker-list=`broker-list.sh`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment