Cloud Native 11 min read

Quick Introduction to etcd: Overview, Use Cases, Architecture, and Installation Guide

This article provides a concise yet comprehensive overview of etcd, covering its background, core features, common application scenarios such as key‑value storage, service discovery, messaging and distributed locking, and detailed step‑by‑step installation methods for various platforms.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Quick Introduction to etcd: Overview, Use Cases, Architecture, and Installation Guide

1. etcd Introduction

etcd, initiated by CoreOS in June 2013 and now a CNCF graduated project, is a distributed key‑value store written in Go, currently at version V3.4.9. It offers simple installation, HTTP API access, hierarchical file‑like storage, watch mechanisms, SSL security, high performance (≈2k reads/s per instance), and strong consistency via the Raft consensus algorithm.

2. etcd Application Scenarios

etcd excels in stability, reliability, and scalability, providing coordination for cloud‑native applications. Typical use cases include:

2.1 Key‑Value Storage

etcd serves as a highly‑available key‑value store for shared configuration and service discovery, offering fast read/write performance, distributed multi‑node reliability, and a file‑directory‑like data model with leaf nodes storing data and non‑leaf nodes acting as directories.

2.2 Service Registration and Discovery

In distributed environments, services register their name, address, and port in etcd, while clients query etcd to discover available instances, enabling dynamic service lookup and health‑checking via TTL‑based keys.

2.3 Message Publishing and Subscribing

etcd can act as a lightweight message broker where producers publish to a topic and consumers subscribe, with TTL ensuring the health status of service instances.

2.4 Distributed Locks

Using Raft‑based consistency, etcd provides atomic compare‑and‑swap (CAS) operations to implement exclusive locks or ordered lock queues, facilitating coordinated resource access across multiple processes.

3. etcd Installation Methods

etcd can be installed via package managers, binary releases, source compilation, or Docker containers.

3.1 Package Manager Installation

On CentOS 7 and macOS 10.15 you can install etcd with:

yum install etcd
brew install etcd

These packages may lag behind the latest release.

3.2 Binary Installation (macOS example)

To install version 3.4.5 on macOS:

ETCD_VER=v3.4.5
GITHUB_URL=https://github.com/etcd-io/etcd/releases/download
DOWNLOAD_URL=${GITHUB_URL}

rm -f /tmp/etcd-${ETCD_VER}-darwin-amd64.zip
rm -rf /tmp/etcd-download-test && mkdir -p /tmp/etcd-download-test

curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-darwin-amd64.zip -o /tmp/etcd-${ETCD_VER}-darwin-amd64.zip
unzip /tmp/etcd-${ETCD_VER}-darwin-amd64.zip -d /tmp && rm -f /tmp/etcd-${ETCD_VER}-darwin-amd64.zip
mv /tmp/etcd-${ETCD_VER}-darwin-amd64/* /tmp/etcd-download-test && rm -rf /tmp/etcd-${ETCD_VER}-darwin-amd64

/tmp/etcd-download-test/etcd --version
/tmp/etcd-download-test/etcdctl version

Output confirms successful installation, e.g.:

etcd Version: 3.4.5
Git SHA: c65a9e2dd
Go Version: go1.12.12
Go OS/Arch: darwin/amd64

3.3 Source Installation

For the latest version, clone the repository and build:

$ go version
go version go1.14.2 darwin/amd64

git clone https://github.com/etcd-io/etcd.git
cd etcd
./build

Run the provided tests to verify a successful build.

4. Glossary of etcd Terms

Raft: Distributed consensus algorithm.

Node: Raft state‑machine instance.

Member: An etcd instance that serves client requests.

Cluster: A set of Members forming an etcd cluster.

Peer: Another Member within the same cluster.

Client: Entity sending HTTP requests to etcd.

WAL: Write‑Ahead Log for persistent storage.

Snapshot: Point‑in‑time data snapshot to limit WAL growth.

Cloud Nativeservice discoveryInstallationRaftetcddistributed key-value store
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.