Developer(s) CoreOS, Inc
Initial release 2015
Stable release
Repository {{#property:P1324}}
Written in Go
Operating system CoreOS
License Apache License

Etcd is a distributed key value store that provides a reliable way to store data across a cluster of machines. It’s open-source and available on GitHub. etcd gracefully handles leader elections during network partitions and will tolerate machine failure, including the leader.

Your applications can read and write data into etcd. A simple use-case is to store database connection details or feature flags in etcd as key value pairs. These values can be watched, allowing your app to reconfigure itself when they change.

Advanced uses take advantage of the consistency guarantees to implement database leader elections or do distributed locking across a cluster of workers.

Technical Overview

etcd is written in Go which has excellent cross-platform support, small binaries and a great community behind it. Communication between etcd machines is handled via the Raft consensus algorithm.

Latency from the etcd leader is the most important metric to track and the built-in dashboard has a view dedicated to this. In our testing, severe latency will introduce instability within the cluster because Raft is only as fast as the slowest machine in the majority. You can mitigate this issue by properly tuning the cluster. etcd has been pre-tuned on cloud providers with highly variable networks.

Getting started

Reading and writing to etcd

The HTTP-based API is easy to use. This guide will show both etcdctl and curl examples. It's important to note the -L flag is required for curl. etcd transparently redirects writes to the leader and this flag allows curl to follow the location headers from etcd.


 $ etcdctl set /message Hello
$ curl -L -X PUT -d value="Hello"


  $ etcdctl get /message
$ curl -L

Delete the key run

$ etcdctl rm /message
$ curl -L -X DELETE

Security model

Client-to-server transport security with HTTPS

$ etcd --name infra0 --data-dir infra0 \
  --cert-file=/path/to/server.crt --key-file=/path/to/server.key \
  --advertise-client-urls= --listen-client-urls=
  curl --cacert /path/to/ca.crt -XPUT -d value=bar -v

Client-to-server authentication with HTTPS client certificates

$ etcd --name infra0 --data-dir infra0 \
  --client-cert-auth --trusted-ca-file=/path/to/ca.crt --cert-file=/path/to/server.crt --key-file=/path/to/server.key \
  --advertise-client-urls --listen-client-urls

Transport security & client certificates in a cluster

DISCOVERY_URL=... # from

# member1
$ etcd --name infra1 --data-dir infra1 \
  --peer-client-cert-auth --peer-trusted-ca-file=/path/to/ca.crt --peer-cert-file=/path/to/member1.crt --peer-key-file=/path/to/member1.key \
  --initial-advertise-peer-urls= --listen-peer-urls= \
  --discovery ${DISCOVERY_URL}

# member2
$ etcd --name infra2 --data-dir infra2 \
  --peer-client-cert-auth --peer-trusted-ca-file=/path/to/ca.crt --peer-cert-file=/path/to/member2.crt --peer-key-file=/path/to/member2.key \
  --initial-advertise-peer-urls= --listen-peer-urls= \
  --discovery ${DISCOVERY_URL}