- Disable the built in etcd in coreos.
This is likely done by modifying theuser-data
aka cloud config file and commenting out thecoreos.etcd
section and thecoreos.etcd.units.etcd.service
section. - Install the new
etcd.service
file.
This can go in/etc/systemd/system/
or it can be put in theuser-data
in thecoreos.etcd.units.etcd.service
section after acontent: |
label. - It is very important to use a NEW discovery url in this file and that the old discovery url is not reused.
- Choose the correct
size
parameter when going tohttps://discovery.etcd.io/new?size=3
. The optimal size is between 3 and 9 according to CoreOS. - If running in vagrant, run
vagrant provision
and thenvagrant reload
. - In AWS, in order to edit the
user-data
the machine must have been turned off, so start it up again. - The new version of etcd should stat up and upgrade the on disk data in
/var/lib/etcd
to the new format. - Check the discovery url to see if the entry for that machine is there, if not, it must be entered manually using a curl command like this:
curl -L https://discovery.etcd.io/<CLUSTER_ID>/<MACHINE_ID> -XPUT -d value=http://<INTERNAL_IP>:7001
. Machine id is listed on each machine at/etc/machine-id
Note that no ttl should be set. - etcd may need to be restarted after all the machines have been added to the discovery system, before the cluster actually comes up.
Last active
August 29, 2015 14:17
-
-
Save joshuarubin/8aa771b2e41e8c6936db to your computer and use it in GitHub Desktop.
etcd 2.0 systemd unit file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=etcd | |
After=docker.service | |
[Service] | |
User=core | |
PermissionsStartOnly=true | |
EnvironmentFile=/etc/environment | |
Restart=always | |
RestartSec=10s | |
Environment="ETCD_VERSION=v2.0.5" | |
Environment="ETCD_DISCOVERY=https://discovery.etcd.io/<YOUR_ETCD_DISCOVERY_URL>" | |
ExecStartPre=-/usr/bin/docker kill %p | |
ExecStartPre=-/usr/bin/docker rm %p | |
ExecStartPre=/usr/bin/sudo /usr/bin/mkdir -p /var/lib/%p | |
ExecStartPre=/usr/bin/sudo /usr/bin/chown -R core:core /var/lib/%p | |
ExecStartPre=/usr/bin/sudo /usr/bin/chattr -R +C /var/lib/%p | |
ExecStartPre=/usr/bin/docker pull quay.io/coreos/etcd:${ETCD_VERSION} | |
ExecStart=/usr/bin/docker run \ | |
--rm \ | |
-p 4001:4001 \ | |
-p 7001:7001 \ | |
--name %p \ | |
-v /var/lib/%p:/data \ | |
-v /usr/share/ca-certificates/:/etc/ssl/certs \ | |
quay.io/coreos/etcd:${ETCD_VERSION} \ | |
-name %m \ | |
-discovery ${ETCD_DISCOVERY} \ | |
-data-dir /data \ | |
-advertise-client-urls http://${COREOS_PRIVATE_IPV4}:4001 \ | |
-listen-client-urls http://0.0.0.0:4001 \ | |
-initial-advertise-peer-urls http://${COREOS_PRIVATE_IPV4}:7001 \ | |
-listen-peer-urls http://0.0.0.0:7001 | |
ExecStop=/usr/bin/docker stop %p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment