etcd2 static clustering so that changed will be persistent after reboot?

60 views
Skip to first unread message

Edgaras Apšega

unread,
Jul 15, 2016, 5:43:46 AM7/15/16
to CoreOS User
If I setup my etcd2 nodes with these instructions https://coreos.com/etcd/docs/latest/clustering.html, etcd2 is running in foreground, but if I'd quit terminal or reboot servers, changes will not be persistent. Any ideas how to overcome this?

Rob Szumski

unread,
Jul 15, 2016, 1:30:30 PM7/15/16
to Edgaras Apšega, CoreOS User
You will need to run etcd via an init system. On CoreOS, this is systemd. The recommended way to do this is with cloud-config, which is a way of lightly configuring machines in a repeatable fashion. Cloud-config will configure systemd for you. You can see what it is creating by running `systemctl cat etcd2.service` after the machine boots.

There is an example here: https://coreos.com/os/docs/latest/cluster-discovery.html As you can see, the flags you were using map directly to config parameters.

 - Rob

On Jul 15, 2016, at 2:43 AM, Edgaras Apšega <r3sp...@gmail.com> wrote:

If I setup my etcd2 nodes with these instructions https://coreos.com/etcd/docs/latest/clustering.html, etcd2 is running in foreground, but if I'd quit terminal or reboot servers, changes will not be persistent. Any ideas how to overcome this?

--
You received this message because you are subscribed to the Google Groups "CoreOS User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coreos-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

E.A.

unread,
Jul 15, 2016, 1:34:38 PM7/15/16
to Rob Szumski, CoreOS User
That's where my main problem comes in. I'm provisioning 3 CoreOS machines via libvirt's virt-install; therefore I'm not using cloud-config. 

Is there another way of configuring etcd2.service? Even switched to root I cannot edit /usr/lib64/systemd/system/etcd2.service -- it says that it's "read-only filesystem".

Edgaras



--
Pagarbiai,
Edgaras Apšega

Rob Szumski

unread,
Jul 15, 2016, 1:36:41 PM7/15/16
to E.A., CoreOS User
You can do it all through straight systemd, place etcd2.service in /etc/systemd/system.

E.A.

unread,
Jul 20, 2016, 1:47:47 PM7/20/16
to Rob Szumski, CoreOS User
This has worked, thanks!

For anyone else struggling with this problem - make similiar etcd2.service files in /etc/systemd/system/ and then systemctl restart etcd2:

$ systemctl cat etcd2
# /etc/systemd/system/etcd2.service
[Unit]
Description=etcd2
Conflicts=etcd.service

[Service]
User=etcd
Type=notify
Environment=ETCD_DATA_DIR=/var/lib/etcd2
Environment=ETCD_NAME=$ETCD_NODE_NAME
Environment="ETCD_ADVERTISE_CLIENT_URLS=http://192.168.1.139:2379"
Environment="ETCD_DISCOVERY=https://discovery.etcd.io/<token>"
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=http://192.168.1.139:2380"
Environment="ETCD_LISTEN_CLIENT_URLS=http://192.168.1.139:2379,http://127.0.0.1:2379"
Environment="ETCD_LISTEN_PEER_URLS=http://192.168.1.139:2380"
ExecStart=/usr/bin/etcd2
Restart=always
RestartSec=10s
LimitNOFILE=40000
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target
--
Pagarbiai,
Edgaras Apšega
Reply all
Reply to author
Forward
0 new messages