docker-compose-files/zookeeper/docker-compose.yaml

69 lines
2.1 KiB
YAML
Raw Permalink Normal View History

2020-02-28 06:39:59 +08:00
# The minimal zookeeper service
2020-02-13 02:30:08 +08:00
# github.com/yeasy/docker-compose-files
2020-02-28 06:39:59 +08:00
# * zk: zk node for zookeeper, 0, 1, 2
# * zookeeper: zookeeper service, will default to connect to zookeeper
# * cli: client to test zookeeper service
2020-02-13 02:30:08 +08:00
version: '3'
services:
zookeeper1:
2020-02-28 06:39:59 +08:00
image: yeasy/zookeeper:3.5.6
2020-02-13 02:30:08 +08:00
container_name: zookeeper1
hostname: zookeeper1
ports:
- "2182:2181" # zk connection port
environment:
- ZK_ID=1 # when bootup, will read this and update the /tmp/zookeeper/myid file
2020-02-28 06:39:59 +08:00
- ZK_HOST1=zk_zookeeper1 # specify the host addrs of each zk
- ZK_HOST2=zk_zookeeper2
- ZK_HOST3=zk_zookeeper3
2020-02-13 02:30:08 +08:00
healthcheck:
disable: true
command: bash -c 'bash /tmp/start_zk.sh'
zookeeper2:
2020-02-28 06:39:59 +08:00
image: yeasy/zookeeper:3.5.6
2020-02-13 02:30:08 +08:00
container_name: zookeeper2
hostname: zookeeper2
ports:
- "2183:2181" # zk connection port
environment:
- ZK_ID=2 # when bootup, will read this and update the /tmp/zookeeper/myid file
2020-02-28 06:39:59 +08:00
- ZK_HOST1=zk_zookeeper1 # specify the host addrs of each zk
- ZK_HOST2=zk_zookeeper2
- ZK_HOST3=zk_zookeeper3
2020-02-13 02:30:08 +08:00
healthcheck:
disable: true
command: bash -c 'bash /tmp/start_zk.sh'
zookeeper3:
2020-02-28 06:39:59 +08:00
image: yeasy/zookeeper:3.5.6
2020-02-13 02:30:08 +08:00
container_name: zookeeper3
hostname: zookeeper3
ports:
- "2181:2181" # zk connection port
environment:
- ZK_ID=3 # when bootup, will read this and update the /tmp/zookeeper/myid file
2020-02-28 06:39:59 +08:00
- ZK_HOST1=zk_zookeeper1 # specify the host addrs of each zk
- ZK_HOST2=zk_zookeeper2
- ZK_HOST3=zk_zookeeper3
2020-02-13 02:30:08 +08:00
healthcheck:
disable: true
command: bash -c 'bash /tmp/start_zk.sh'
2020-02-28 06:39:59 +08:00
cli: # used for testing zookeeper cmds, see /tmp/*.sh
image: yeasy/zookeeper:3.5.6
2020-02-13 02:30:08 +08:00
container_name: cli
hostname: cli
environment:
- ZK_HOST=zookeeper1 # zk host to connect to
2020-02-28 06:39:59 +08:00
- ZK_HOST1=zk_zookeeper1 # specify the host addrs of each zk
- ZK_HOST2=zk_zookeeper2
- ZK_HOST3=zk_zookeeper3
2020-02-13 02:30:08 +08:00
healthcheck:
disable: true
2020-02-28 06:39:59 +08:00
# bash /opt/zookeeper/bin/zkCli.sh -server ${ZK_HOST}:2181
2020-02-13 02:30:08 +08:00
command: bash -c 'while true; do sleep 20200116; done'