docker之安装zookeeper

**一般安装
创建一个内网**
docker network create -d bridge –subnet 172.21.0.0/16 zookeeper
创建三节点
docker run -itd -e ZOO_MY_ID=2 -e ZOO_SERVERS=”server.1=172.21.0.2:2888:3888 server.2=172.21.0.3:2888:3888 server.3=172.21.0.4:2888:3888” –name=zookeeper2 –network=zookeeper –privileged -p 21812:2181 zookeeper
docker run -itd -e ZOO_MY_ID=3 -e ZOO_SERVERS=”server.1=172.21.0.2:2888:3888 server.2=172.21.0.3:2888:3888 server.3=172.21.0.4:2888:3888” –name=zookeeper3 –network=zookeeper –privileged -p 21813:2181 zookeeper
docker run -itd -e ZOO_MY_ID=1 -e ZOO_SERVERS=”server.1=172.21.0.2:2888:3888 server.2=172.21.0.3:2888:3888 server.3=172.21.0.4:2888:3888” –name=zookeeper1 –network=zookeeper –privileged -p 21811:2181 zookeeper
测试
这里写图片描述
方法二
**使用docker-compose安装
安装python-pip**
yum -y install epel-release
yum -y install python-pip
安装docker-compose
pip install docker-compose
docker-compose version
创建docker-compose.yml
docker之安装zookeeper_第1张图片
docker之安装zookeeper_第2张图片
启动
docker-compose up -d

你可能感兴趣的:(docker,zookeeper,docker,zk,zookeeper)