Docker容器—搭建zookeeper真集群版

本文主要记录通过docker搭建zookeeper真集群版

1
docker run --restart always -d -e ZOO_MY_ID=1  -e ZOO_SERVERS="server.1=172.16.1.30:2888:3888 2181 server.2=172.16.1.31:2888:3888 2181 server.3=172.16.1.32:2888:3888 2181" --name=zookeeper  --net=host  --privileged  zookeeper:3.4.14
1
docker run --restart always -d -e ZOO_MY_ID=2  -e ZOO_SERVERS="server.1=172.16.1.30:2888:3888 2181 server.2=172.16.1.31:2888:3888 2181 server.3=172.16.1.32:2888:3888 2181" --name=zookeeper  --net=host  --privileged  zookeeper:3.4.14
1
docker run --restart always -d -e ZOO_MY_ID=3  -e ZOO_SERVERS="server.1=172.16.1.30:2888:3888 2181 server.2=172.16.1.31:2888:3888 2181 server.3=172.16.1.32:2888:3888 2181" --name=zookeeper  --net=host  --privileged  zookeeper:3.4.14

三台虚拟机,安装docker后分别执行以上命令

注意ZOO_MY_ID代表每台机器的标识

如果日志有报错,确保同时启动zookeeper

-->