docker部署kafka

1. 部署zookeeper

docker run  --name=zookeeper \
-p 2181:2181 \
--restart always \
-d zookeeper:latest

2. 部署kafka

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

 

你可能感兴趣的:(docker&k8s)