docker-compose file with kafka.
It allows to run kafka on dev machine without installing it. It contains zookeeper, kafka, kafka-topics-creator.
kafka-topics-creator creates topics and exists.
Note, there is one kafka broker; each topic has replication factor 1 and each topic has one partition.
After kafka-topics-creator finished, you can check the topics.
-
connect to the kafka broker container.
docker exec -it kafka bash. On Windows machine, you may needwinpty docker exec -it kafka bash. -
Navigate to kafka directory. In this example,
cd usr/bin. -
Check kafka topics with
kafka-topics --list --zookeeper zookeeper:32181https://stackoverflow.com/questions/44405663/list-all-kafka-topics