Quickstart

Get etcd up and running in less than 5 minutes!

Follow the instructions below to locally install, run, and test a simple single-member cluster of etcd.

Install etcd

To help with the commands that follow, set these environment variables:

  1. ETCD_VER=v3.5.0
  2. ETCD_BIN=/tmp/test-etcd
  3. GOOGLE_URL=https://storage.googleapis.com/etcd
  4. GITHUB_URL=https://github.com/etcd-io/etcd/releases/download

Download and install etcd from pre-built binaries:

On Linux

  1. DOWNLOAD_URL=${GITHUB_URL}
  2. rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
  3. rm -rf $ETCD_BIN
  4. mkdir -p $ETCD_BIN
  5. curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
  6. tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C $ETCD_BIN --strip-components=1

On macOS

  1. DOWNLOAD_URL=${GOOGLE_URL}
  2. rm -f /tmp/etcd-${ETCD_VER}-darwin-amd64.zip
  3. rm -rf /tmp/etcd-${ETCD_VER}-darwin-amd64
  4. rm -rf $ETCD_BIN
  5. mkdir -p $ETCD_BIN
  6. curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-darwin-amd64.zip -o /tmp/etcd-${ETCD_VER}-darwin-amd64.zip
  7. unzip /tmp/etcd-${ETCD_VER}-darwin-amd64.zip -d /tmp
  8. ln -s /tmp/etcd-${ETCD_VER}-darwin-amd64/* $ETCD_BIN

Note

To work with the latest version, learn how to build from the main branch.

Launch etcd

  1. $ $ETCD_BIN/etcd
  2. {"level":"warn","ts":"2021-05-12T11:03:01.247-0700","caller":"etcdmain/etcd.go:119","msg":"'data-dir' was empty; using default","data-dir":"default.etcd"}

Set and get a key

From another terminal, use etcdctl to set a key:

  1. $ $ETCD_BIN/etcdctl put greeting "Hello, etcd"
  2. OK

Now that a key has been set, retrieve it:

  1. $ $ETCD_BIN/etcdctl get greeting
  2. greeting
  3. Hello, etcd

What’s next?

Learn about more ways to configure and use etcd from the following pages:

Last modified June 14, 2021: Renaming content/en/next folder to content/en/v3.5. Updating redirects, links, and config as needed. (#363) (138926b)