CentOS-Docker搭建Kafka(单点,含:zookeeper、kafka-manager)
Docker搭建Kafka(单点,含:zookeeper、kafka-manager)
下载相关容器
$ docker pull wurstmeister/zookeeper
$ docker pull wurstmeister/kafka
$ docker pull sheepkiller/kafka-manager
运行相关容器
启动zookeeper
$ docker run -d --name zookeeper --publish 2181:2181 \
-v /etc/localtime:/etc/localtime --restart=always wurstmeister/zookeeper
启动kafka
$ docker run -d --name kafka --publish 9082:9092 \
--link zookeeper:zookeeper \
--env KAFKA_BROKER_ID=100 \
--env HOST_IP=192.168.1.108 \
--env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \
--env KAFKA_ADVERTISED_HOST_NAME=192.168.1.108 \
--env KAFKA_ADVERTISED_PORT=9082 \
-v /etc/localtime:/etc/localtime --restart=always wurstmeister/kafka
启动kafka-manager
$ docker run -d --name kafka-manager -p 9000:9000 \
--link zookeeper:zookeeper --link kafka:kafka --env ZK_HOSTS=zookeeper:2181 \
--restart=always sheepkiller/kafka-manager
访问KafkaManager
http://ip:9000/
![](https://oscimg.oschina.net/oscnet/up-b6e33b89d7eded707ee667810e8d91d9223.png)