docker-composer.yml文件
version: '3'
services:
etcd-1:
container_name: etcd1
image: quay.io/coreos/etcd:v3.4.7
entrypoint: /usr/local/bin/etcd
command:
- '--name=etcd-1'
- '--initial-advertise-peer-urls=http://etcd-1:2380'
- '--listen-peer-urls=http://0.0.0.0:2380'
- '--listen-client-urls=http://0.0.0.0:2379'
- '--advertise-client-urls=http://etcd-1:2379'
- '--initial-cluster-token=mys3cr3ttok3n'
- '--heartbeat-interval=250'
- '--election-timeout=1250'
- '--initial-cluster=etcd-1=http://etcd-1:2380,etcd-2=http://etcd-2:2380,etcd-3=http://etcd-3:2380'
- '--initial-cluster-state=new'
ports:
- 2379
volumes:
- etcd1:/etcd_data
etcd-2:
container_name: etcd2
image: quay.io/coreos/etcd:v3.4.7
entrypoint: /usr/local/bin/etcd
command:
- '--name=etcd-2'
- '--initial-advertise-peer-urls=http://etcd-2:2380'
- '--listen-peer-urls=http://0.0.0.0:2380'
- '--listen-client-urls=http://0.0.0.0:2379'
- '--advertise-client-urls=http://etcd-2:2379'
- '--initial-cluster-token=mys3cr3ttok3n'
- '--heartbeat-interval=250'
- '--election-timeout=1250'
- '--initial-cluster=etcd-1=http://etcd-1:2380,etcd-2=http://etcd-2:2380,etcd-3=http://etcd-3:2380'
- '--initial-cluster-state=new'
ports:
- 2379
volumes:
- etcd2:/etcd_data
etcd-3:
container_name: etcd3
image: quay.io/coreos/etcd:v3.4.7
entrypoint: /usr/local/bin/etcd
command:
- '--name=etcd-3'
- '--initial-advertise-peer-urls=http://etcd-3:2380'
- '--listen-peer-urls=http://0.0.0.0:2380'
- '--listen-client-urls=http://0.0.0.0:2379'
- '--advertise-client-urls=http://etcd-3:2379'
- '--initial-cluster-token=mys3cr3ttok3n'
- '--heartbeat-interval=250'
- '--election-timeout=1250'
- '--initial-cluster=etcd-1=http://etcd-1:2380,etcd-2=http://etcd-2:2380,etcd-3=http://etcd-3:2380'
- '--initial-cluster-state=new'
ports:
- 2379
volumes:
- etcd3:/etcd_data
volumes:
etcd1:
etcd2:
etcd3: