Programster's Blog

Tutorials focusing on Linux, programming, and open source

Debian - Install Etcd

About Etcd

etcd is an open-source distributed key value store that provides shared configuration and service discovery. We are interested in using etcd as it is one of the supported discovery service backends supported by Docker in order to deploy a docker swarm (cluster). Alternative backends include consul and zookeeper.


Navigate to the releases page of etcd. At the time of writing this post, the latest version is 2.2.2 and installation is as simple as:

sudo apt-get install curl -y
curl -L -o etcd-v2.2.2-linux-amd64.tar.gz
tar xzvf etcd-v2.2.2-linux-amd64.tar.gz
rm etcd-v2.2.2-linux-amd64.tar.gz

Now to start the etcd process, execute:

cd etcd-v2.2.2-linux-amd64

You may want to just add the etcd binary to your $PATH

Example Usage

etcdctl set mykey "this is awesome"
etcdctl get mykey

You will need to execute these commands within your installation folder, or have added etcdl to your $PATH.

Running Through Docker

Etcd can be run through using docker. First install docker if you haven't already. Then execute:

docker run \
--name etcd \

Example Usage

docker exec etcd /etcdctl set foo bar
docker exec etcd /etcdctl get foo

The above example is the simplest way to get started, but there is a guide for more advanced setups through docker.

Remote Invokation using Curl

To test that your remote etcd server is listening to external requests, you can send a request from another machine with curl.

To set a value of Hello World for the key: message on the server at, you would use:

curl -L \ \
-XPUT -d value="Hello world"

To retrieve the value for the key: message on the server at, you would use:

curl -L