etcd is a distributed, reliable key-value store for the most critical data of a distributed system. It serves as the backbone for Kubernetes and other cloud-native systems.
📑 Table of Contents
Key Features
- Consistency: Raft consensus algorithm
- Watch API: Subscribe to key changes
- Transactions: Atomic operations
- TTL: Key expiration support
- gRPC API: Modern communication protocol
Installation
Install etcd on Ubuntu:
ETCD_VER=v3.5.11
curl -L https://github.com/etcd-io/etcd/releases/download/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o etcd.tar.gz
tar xzvf etcd.tar.gz
sudo mv etcd-${ETCD_VER}-linux-amd64/etcd* /usr/local/bin/
Usage Examples
etcd operations:
# Start etcd
etcd --data-dir=/var/lib/etcd
# Put key-value
etcdctl put mykey "Hello World"
# Get value
etcdctl get mykey
# Watch for changes
etcdctl watch mykey
# List all keys
etcdctl get "" --prefix --keys-only
# Delete key
etcdctl del mykey
Benefits
etcd provides reliable storage for distributed system configuration. Its strong consistency guarantees make it ideal for leader election and service discovery.
Was this article helpful?