[kafka] Kafka Docker单机环境搭建

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sai_j/article/details/82941271

Kafka搭建

docker pull wurstmeister/zookeeper
docker pull wurstmeister/kafka

docker run -d --name zookeeper  -p 2181:2181 -t wurstmeister/zookeeper 

docker run -d --name kafka --publish 9092:9092 \
--link zookeeper \
--env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \
--env KAFKA_ADVERTISED_HOST_NAME=127.0.0.1 \
--env KAFKA_ADVERTISED_PORT=9092 \
wurstmeister/kafka

SmokeTest

sudo docker exec -it kafka /bin/bash

/opt/kafka/bin/kafka-console-producer.sh --topic=test --broker-list localhost:9092

/opt/kafka/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 -from-beginning --topic test

没有更多推荐了,返回首页