Skip to content

Instantly share code, notes, and snippets.

@skinny
Last active October 26, 2015 23:47
Show Gist options
  • Save skinny/dd39a45d51db24eb2763 to your computer and use it in GitHub Desktop.
Save skinny/dd39a45d51db24eb2763 to your computer and use it in GitHub Desktop.
etcd config
#cloud-config
coreos:
units:
- name: etcd2.service
drop-ins:
- name: 50-etcd-initial-cluster.conf
content: >
[Service]
Environment=ETCD_INITIAL_CLUSTER=node-00=http://node-00:2380,node-01=http://node-01:2380,node-02=http://node-02:2380
etcd2:
name: '%H'
initial-cluster-token: eva-cluster
initial-advertise-peer-urls: 'http://%H:2380'
listen-peer-urls: 'http://%H:2380'
listen-client-urls: 'http://0.0.0.0:2379'
advertise-client-urls: 'http://%H:2379'
initial-cluster-state: new
hostname: node-00
--------
core@node-00 ~ $ etcdctl member add node-02 http://node-02:2380
Added member named node-02 with ID 2bce7a7caace9a3c to cluster
ETCD_NAME="node-02"
ETCD_INITIAL_CLUSTER="node-02=http://node-02:2380,node-00=http://node-00:2380,node-01=http://node-01:2380"
ETCD_INITIAL_CLUSTER_STATE="existing"
------
node-02 etcd2.service.d # systemctl cat etcd2
# /usr/lib64/systemd/system/etcd2.service
[Unit]
Description=etcd2
Conflicts=etcd.service
[Service]
User=etcd
Environment=ETCD_DATA_DIR=/var/lib/etcd2
Environment=ETCD_NAME=%m
ExecStart=/usr/bin/etcd2
Restart=always
RestartSec=10s
LimitNOFILE=40000
[Install]
WantedBy=multi-user.target
# /run/systemd/system/etcd2.service.d/20-cloudinit.conf
[Service]
Environment="ETCD_ADVERTISE_CLIENT_URLS=http://%H:2379"
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=http://%H:2380"
Environment="ETCD_INITIAL_CLUSTER_STATE=new"
Environment="ETCD_INITIAL_CLUSTER_TOKEN=eva-cluster"
Environment="ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379"
Environment="ETCD_LISTEN_PEER_URLS=http://%H:2380"
Environment="ETCD_NAME=%H"
# /etc/systemd/system/etcd2.service.d/50-etcd-initial-cluster.conf
[Service]
Environment=ETCD_INITIAL_CLUSTER_STATE=existing
Environment=ETCD_INITIAL_CLUSTER=node-00=http://node-00:2380,node-01=http://node-01:2380,node-02=http://node-02:2380
node-02 etcd2.service.d #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment