Skip to content

Instantly share code, notes, and snippets.

@sonnysideup
Created January 4, 2017 12:32
Show Gist options
  • Save sonnysideup/99b6e81172611b0efb013f8f10d5e40d to your computer and use it in GitHub Desktop.
Save sonnysideup/99b6e81172611b0efb013f8f10d5e40d to your computer and use it in GitHub Desktop.
# launch kafka broker in background
docker run -p 2181:2181 -p 9092:9092 -e ADVERTISED_HOST=localhost -e ADVERTISED_PORT=9092 -d spotify/kafka
# launch any kafka binary command against broker running in the background
# generic structure
docker run --net=host -ti spotify/kafka <YOUR_CMD>
# create a new topic
docker run --net=host -ti spotify/kafka \
/opt/kafka_2.11-0.10.1.0/bin/kafka-topics.sh \
--zookeeper localhost:2181 --create --topic new_svc_request --partitions 1 --replication-factor 1
# describe all topics
docker run --net=host -ti spotify/kafka \
/opt/kafka_2.11-0.10.1.0/bin/kafka-topics.sh \
--zookeeper localhost:2181 --describe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment