Skip to content

Instantly share code, notes, and snippets.

@kelein
Created October 25, 2017 03:19
Show Gist options
  • Save kelein/0a9ac359daeb0912c2678c20ae7a1087 to your computer and use it in GitHub Desktop.
Save kelein/0a9ac359daeb0912c2678c20ae7a1087 to your computer and use it in GitHub Desktop.
Etcd Cluster with docker container
version: '2'
services:
etcd_peer1:
image: quay.io/coreos/etcd:v2.0.3
ports:
- '4001:4001'
- '2379:2379'
- '2380:2380'
volumes:
- /etc/timezone:/etc/timezone
- /etc/localtime:/etc/localtime
command: [
'--name', 'etcd0',
'--advertise-client-urls', 'http://10.200.3.98:2379,http://10.200.3.98:4001',
'--listen-client-urls', 'http://10.200.3.98:2379,http://10.200.3.98:4001',
'--initial-advertise-peer-urls', 'http://10.200.3.98:2380',
'--listen-peer-urls', 'http://10.200.3.98:2380',
'--initial-cluster-token', 'etcd-cluster-1',
'--initial-cluster', 'etcd0=http://10.200.3.98:2380,etcd1=http://10.200.3.98:2480,etcd2=http://10.200.3.98:2580',
'--force-new-cluster', 'false'
]
hostname: 'etcd_peer1'
network_mode: 'host'
etcd_peer2:
image: quay.io/coreos/etcd:v2.0.3
ports:
- '4101:4101'
- '2479:2479'
- '2480:2480'
volumes:
- /etc/timezone:/etc/timezone
- /etc/localtime:/etc/localtime
command: [
'--name', 'etcd1',
'--advertise-client-urls', 'http://10.200.3.98:2479,http://10.200.3.98:4101',
'--listen-client-urls', 'http://10.200.3.98:2479,http://10.200.3.98:4101',
'--initial-advertise-peer-urls', 'http://10.200.3.98:2480',
'--listen-peer-urls', 'http://10.200.3.98:2480',
'--initial-cluster-token', 'etcd-cluster-1',
'--initial-cluster', 'etcd0=http://10.200.3.98:2380,etcd1=http://10.200.3.98:2480,etcd2=http://10.200.3.98:2580',
'--force-new-cluster', 'false'
]
hostname: 'etcd_peer2'
network_mode: 'host'
etcd_peer3:
image: quay.io/coreos/etcd:v2.0.3
ports:
- '4201:4201'
- '2579:2579'
- '2580:2580'
volumes:
- /etc/timezone:/etc/timezone
- /etc/localtime:/etc/localtime
command: [
'--name', 'etcd2',
'--advertise-client-urls', 'http://10.200.3.98:2579,http://10.200.3.98:4201',
'--listen-client-urls', 'http://10.200.3.98:2579,http://10.200.3.98:4201',
'--initial-advertise-peer-urls', 'http://10.200.3.98:2580',
'--listen-peer-urls', 'http://10.200.3.98:2580',
'--initial-cluster-token', 'etcd-cluster-1',
'--initial-cluster', 'etcd0=http://10.200.3.98:2380,etcd1=http://10.200.3.98:2480,etcd2=http://10.200.3.98:2580',
'--force-new-cluster', 'false'
]
hostname: 'etcd_peer3'
network_mode: 'host'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment