How to configure kafa stand-alone docker
This article mainly explains "how to configure kafa stand-alone docker". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to configure kafa stand-alone docker".
1. Start zookeeper
Sudo docker run-d-- name zookeeper-- publish 2181
-- volume / etc/localtime:/etc/localtime\
-- volume / data/zookeeper/data:/data\
-- volume / data/zookeeper/datalog:/datalog\
-- volume / data/zookeeper/logs:/logs\
-- restart always\ # when Docker is restarted, the container restarts automatically
Zookeeper:3.5.8
2. Start kafka
Sudo docker run-d-- name kafka-- publish 9092
-- link zookeeper\
-- env KAFKA_BROKER_ID=0\
-- env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181\
-- env KAFKA_ADVERTISED_HOST_NAME= public IP\
-- env KAFKA_ADVERTISED_PORT=9092\
-- env KAFKA_LISTENERS= PLAINTEXT://0.0.0.0:9092\
-- env KAFKA_AUTO_CREATE_TOPICS_ENABLE=false\
-- env KAFKA_LOG_DIRS=/kafka\
-- volume / etc/localtime:/etc/localtime\ # Container time zone is the same as host
-volume / data/kafka:/kafka\ #
Wurstmeister/kafka:2.12-2.4.1
3. Create a theme
Bin/kafka-topics.sh-create-zookeeper zookeeper:2181-replication-factor 1-partitions 1-topic mytest
4. Production data
Bin/kafka-console-producer.sh-broker-list localhost:9092-topic mytest
Note: the CVM must open the response port, such as 2181, 9092, etc.
At this point, I believe you have a deeper understanding of "how to configure kafa stand-alone docker". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!