spotify / docker-kafka

Kafka (and Zookeeper) in Docker
Apache License 2.0
1.4k stars 643 forks source link

add demo documentation #64

Open abacaphiliac opened 7 years ago

abacaphiliac commented 7 years ago

add demo documentation. user starts container named kafka with kafka as the ADVERTISED_HOST, creates a topic, starts a Producer in another container window, and starts a Consumer in another container window. Producer and Consumer will self-destruct when the user quits of the exec commands.

i thought i'd bring my findings back to this project, since i ran into the same n00b issues as some users here: https://github.com/spotify/docker-kafka/issues/49

copied from a gist i made this morning: https://gist.github.com/abacaphiliac/f0553548f9c577214d16290c2e751071

no sweat if you think these docs don't belong in your project. thanks for making a very simple container to work with : )

abacaphiliac commented 7 years ago

thanks to @kpankonen for helping me understand how ADVERTISED_HOST affects other containers.

gg7 commented 7 years ago

I don't see why most people (anyone?) would bother with ADVERTISED_HOST. Not only is advertised.host.name deprecated, but you most likely won't need it. Running my fork (Kafka 0.10.1.1 and other improvements):

docker run -d --name kafka --hostname kafka gg77/kafka
docker exec -it kafka /bin/bash -c "echo 'get /brokers/ids/0' | ~kafka/kafka/bin/zookeeper-shell.sh localhost:2181" | grep endpoints
{"jmx_port":-1,"timestamp":"1484877403562","endpoints":["PLAINTEXT://kafka:9092"],"host":"kafka","version":3,"port":9092}

What am I missing?

abacaphiliac commented 7 years ago

@gg7 thanks for the tip regarding deprecation. i wasn't aware. i'm new to Kafka and found this project to be the easiest to work with out of the small set i tried.