docker-compose-zookeeper-cluster.yml

version: '3.5'

networks:
docker_net:
external: true

services:
zoo1:
image: zookeeper
restart: unless-stopped
hostname: zoo10
container_name: zoo11
ports:
- 2182: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
volumes:
- /www/zookeeper/zoo1/data:/data
- /www/zookeeper/zoo1/datalog:/datalog
networks:
- docker_net

zoo2:
image: zookeeper
restart: unless-stopped
hostname: zoo20
container_name: zoo22
ports:
- 2183:2181
environment:
ZOO_MY_ID: 2
ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=0.0.0.0:2888:3888;2181 server.3=zoo3:2888:3888;2181
volumes:
- /www/zookeeper/zoo2/data:/data
- /www/zookeeper/zoo2/datalog:/datalog
networks:
- docker_net

zoo3:
image: zookeeper
restart: unless-stopped
hostname: zoo30
container_name: zoo33
ports:
- 2184:2181
environment:
ZOO_MY_ID: 3
ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=0.0.0.0:2888:3888;2181
volumes:
- /www/zookeeper/zoo3/data:/data
- /www/zookeeper/zoo3/datalog:/datalog
networks:
- docker_net

上一篇:使用Docker快速搭建ZooKeeper集群


下一篇:安装zookeeper