Skip to content

Instantly share code, notes, and snippets.

@wrfly
Created June 17, 2019 02:56
Show Gist options
  • Save wrfly/6f1aa3cd4b8f3ba2fa132ba21a6a049f to your computer and use it in GitHub Desktop.
Save wrfly/6f1aa3cd4b8f3ba2fa132ba21a6a049f to your computer and use it in GitHub Desktop.
docker compose etcd cluster
version: '2'
services:
etcd1:
image: quay.io/coreos/etcd:v3.1.13
restart: always
ports:
- 23791:2379
- 23801:2380
environment:
ETCD_NAME: infra1
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd1:2380
ETCD_INITIAL_CLUSTER: infra3=http://etcd3:2380,infra1=http://etcd1:2380,infra2=http://etcd2:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_INITIAL_CLUSTER_TOKEN: etcd-tasting-01
ETCD_LISTEN_CLIENT_URLS: http://etcd1:2379,http://localhost:2379
ETCD_LISTEN_PEER_URLS: http://etcd1:2380
ETCD_ADVERTISE_CLIENT_URLS: http://etcd1:2379
etcd2:
image: quay.io/coreos/etcd:v3.1.13
restart: always
ports:
- 23792:2379
- 23802:2380
environment:
ETCD_NAME: infra2
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd2:2380
ETCD_INITIAL_CLUSTER: infra3=http://etcd3:2380,infra1=http://etcd1:2380,infra2=http://etcd2:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_INITIAL_CLUSTER_TOKEN: etcd-tasting-01
ETCD_LISTEN_CLIENT_URLS: http://etcd2:2379,http://localhost:2379
ETCD_LISTEN_PEER_URLS: http://etcd2:2380
ETCD_ADVERTISE_CLIENT_URLS: http://etcd2:2379
etcd3:
image: quay.io/coreos/etcd:v3.1.13
restart: always
ports:
- 23793:2379
- 23803:2380
environment:
ETCD_NAME: infra3
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd3:2380
ETCD_INITIAL_CLUSTER: infra3=http://etcd3:2380,infra1=http://etcd1:2380,infra2=http://etcd2:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_INITIAL_CLUSTER_TOKEN: etcd-tasting-01
ETCD_LISTEN_CLIENT_URLS: http://etcd3:2379,http://localhost:2379
ETCD_LISTEN_PEER_URLS: http://etcd3:2380
ETCD_ADVERTISE_CLIENT_URLS: http://etcd3:2379
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment