更具体地说,如果zookeeper1容器启动的ID是1,那么ZOO_SERVERS环境变量必须是0.0.0.0:2888:3888,zookeeper2:2888:3888,zookeeper3:2888:3888,或者如果zookeeper服务器的ID不是-sequential 那么需要指定它们 0.0.0.0:2888:3888::2,zookeeper2:2888:3888::4.zookeeper3:2888:3888::6 见下文: 创建Docker 网络以通过 do...
ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181 zoo3: image: zookeeper restart: always ports: - 2184:2181 environment: ZOO_MY_ID: 3 ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:38...
ZOO_SERVERS 是集群中的主机列表。在 docker-compose.yml 所在目录下执行 docker-compose up,可以看到启动的日志。连接 ZooKeeper 将集群启动起来以后我们可以连接 ZooKeeper 对其进行节点的相关操作。1.首先需要下载 ZooKeeper。2.将其解压。3.进入其 conf/ 目录,将 zoo_sample .cfg 改成 zoo.cfg。配置文件说明 ...
-e"ZOO_SERVERS=server.1=172.18.0.2:2888:3888;2181 server.2=172.18.0.3:2888:3888;2181 server.3=172.18.0.4:2888:3888;2181"zookeeper 节点3 dockerrun-d -p 2183:2181 --name zookeeper_node03 --privileged --restart always --network zoonet --ip 172.18.0.4 \ -v /data/zookeeper/cluster/zk3/...
sudo docker run -d -p 2181:2181 -e "ZOO_MY_ID: 1" -e "ZOO_SERVERS: server.1=zoo1:2888:3888;2181" --name zoo zookeeper # 停止并删除容器 sudo docker stop zoo && sudo docker rm zoo 1. 2. 3. 4. 其中有两个环境变量:
zoo1: image: zookeeper restart: always hostname: zoo1 - 2181:2181 environment: ZOO_MY_ID: 1 ZOO_SERVERS: server.1=0.0.0.0:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181 zoo2: image: zookeeper restart: always ...
zoo1: image: zookeeper restart: always hostname: zoo1 ports: - 2181:2181 environment: ZOO_MY_ID: 1 ZOO_SERVERS: server.1=0.0.0.0:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181 zoo2: image: zookeeper ...
首先准备拷贝一份zookeeper目录到另外一台服务器上,并修改其中的配置文件zoo.cfg,如下所示: tickTime=2000 dataDir=/var/lib/zookeeper clientPort=2181 initLimit=5 syncLimit=2 server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 ...
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 zoo3: image: zookeeper restart: always container_name: zoo3 ports: - "2183:2181" environment: ZOO_MY_ID: 3 ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888...
zoo2: image: zookeeper restart: always hostname: zoo2 ports: - 2182:2181 environment: ZOO_MY_ID: 2 ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zoo3:2888:3888 zoo3: image: zookeeper restart: always ...