Apache Zookeeper + Apache Kafka start / restart script

Datetime:2016-08-23 00:29:02         Topic: ZooKeeper  Apache Kafka          Share        Original >>
Here to See The Original Article!!!

During my  work on Karafka framework I have to start/stop/restart Apache Kafka and Zookeeper quite often. Here’s a short script that will pull the most recent version of Kafka and Zookeeper, will run them and print their IPs.

Note, that it will also stop Kafka and Zookeeper if they were running.


docker stop zookeeper
docker stop kafka
docker rm zookeeper
docker rm kafka

docker pull jplock/zookeeper
docker pull ches/kafka

docker run \
  -d \
  --name zookeeper \

docker run \
  -d \
  --name kafka \
  --link zookeeper:zookeeper \

ZOOKEEPER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' zookeeper)
KAFKA_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' kafka)

echo "Zookeeper chroot: $ZOOKEEPER_CHROOT"
echo "Zookeeper: $ZOOKEEPER_IP"
echo "Kafka: $KAFKA_IP"

Post Views: 0


Put your ads here, just $200 per month.