赞
踩
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:zookeeper -e KAFKA_BROKER_ID=1 -e HOST_IP=172.17.137.55 -e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://172.17.137.55:9092 -e KAFKA_ADVERTISED_HOST_NAME=172.17.137.55 -e KAFKA_ADVERTISED_PORT=9082 --restart=always -t wurstmeister/kafka
进入kafka容器
docker exec -it kafka /bin/sh
cd opt/kafka_2.13-2.8.1
bin/kafka-topics.sh --create --zookeeper 172.17.137.55:2181 --replication-factor 1 --partitions 1 --topic partopic
4.查看topic的状态,在kafka容器中的opt/kafka_2.11-2.0.0/目录下输入bin/kafka-topics.sh --describe --zookeeper 172.17.137.55:2181 --topic partopic
./kafka-console-producer.sh --broker-list 172.17.137.55:9092 --topic partopic
kafka-console-consumer.sh --bootstrap-server 172.17.137.55:9092 --topic partopic --from-beginning
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。