赞
踩
docker pull zookeeper
docker pull wurstmeister/kafka
docker network create --driver bridge zookeeper_network
【Linux操作系统使用Docker部署Zookeeper】
docker run -d --name zookeeper_kafka --network zookeeper_network -p 2181:2181 zookeeper
--network 指定的网络
-p:设置映射端口(默认2181)
-d:后台启动
docker inspect zookeeper_network
[root@VM-4-9-centos ~]# docker exec -it zookeeper_kafka /bin/bash
root@032659ab5a02:/apache-zookeeper-3.7.0-bin# ls
LICENSE.txt NOTICE.txt README.md README_packaging.md bin conf docs lib
root@032659ab5a02:/apache-zookeeper-3.7.0-bin# cd bin/
root@032659ab5a02:/apache-zookeeper-3.7.0-bin/bin# zkCli.sh
# 启动kafka
docker run -d --name kafka_zookeeper --network zookeeper_network -p 9092:9092 -e KAFKA_BROKER_ID=0 -e KAFKA_ZOOKEEPER_CONNECT=<zookeeperIP地址>:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://<宿主机IP地址>:9092 -e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 wurstmeister/kafka
--network 指定的网络
-p:设置映射端口(默认2181)
-d:后台启动
KAFKA_BROKER_ID=0 kafka的broker的ID号,在kafka集群中,每个kafka都有一个BROKER_ID来区分自己
KAFKA_ZOOKEEPER_CONNECT 配置zookeeper管理kafka的路径
KAFKA_ADVERTISED_LISTENERS 把kafka的地址端口注册给zookeeper
KAFKA_LISTENERS 配置kafka的监听端口
好了,到这里【Docker安装部署kafka+zookeeper】就完成了,接下来我们将继续学习zookeeper+kafka基本命令的使用,敬请期待!!!!^ _ ^
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。