etcd
Distributed key-value store for configuration, service discovery
TLDR
Start a single-node etcd cluster
Start a single-node etcd cluster, listening for client requests on a custom URL
Start a single-node etcd cluster with a custom name
Start a single-node etcd cluster with extensive metrics available at
SYNOPSIS
etcd [--config-file path] [flags]
PARAMETERS
--name string
Human-readable name for this member (default: default)
--data-dir string
Directory to store data (default: default.etcd)
--listen-client-urls urls
URLs to listen for client traffic (default: http://localhost:2379)
--advertise-client-urls urls
Client URLs to advertise to cluster (default: http://localhost:2379)
--listen-peer-urls urls
URLs to listen for peer traffic (default: http://localhost:2380)
--initial-advertise-peer-urls urls
Peer URLs to advertise (default: http://localhost:2380)
--initial-cluster cluster-config
Initial cluster config (e.g., default=http://localhost:2380)
--initial-cluster-state new|existing
Bootstrap state (default: new)
--initial-cluster-token string
Cluster token for bootstrap (default: etcd-cluster)
--heartbeat-interval duration
Raft heartbeat interval (default: 100ms)
--election-timeout duration
Raft election timeout (default: 1s)
--snapshot-count uint
Wal entries per snapshot (default: 10000)
--client-cert-auth
Enable client cert auth
--cert-file path
TLS cert path
--key-file path
TLS key path
--trusted-ca-file path
CA cert path
--peer-cert-file path
Peer TLS cert
--peer-key-file path
Peer TLS key
--peer-trusted-ca-file path
Peer CA cert
--auto-compaction-mode mode
Compaction mode: periodic|revision|background
--auto-compaction-retention duration
Retention period for compaction
--max-request-bytes uint
Max request size (default: 1.5MB)
--experimental-enable-v2
Enable v2 API (deprecated)
--config-file path
Path to config YAML/JSON
--force-new-cluster
Force new cluster from existing data
--enable-v2
Enable v2 support (legacy)
--version
Print version
--help
Show help
DESCRIPTION
etcd is a distributed, reliable key-value store designed for storing critical configuration data in distributed systems. It uses the Raft consensus algorithm to ensure data consistency and high availability across a cluster of nodes. etcd provides a simple HTTP API for watch, put, get, delete, lease, and auth operations, making it ideal for service discovery, configuration management, and coordination.
Primarily used by Kubernetes as the backing store for cluster state (e.g., pods, services, configmaps), etcd is deployed as a cluster (typically 3-5 nodes for production) to tolerate failures. It supports features like TLS encryption, authentication (RBAC), snapshots for backups, compaction for storage efficiency, and alarms for resource limits. etcd runs as a standalone binary on Linux, listening on client (default: 2379) and peer (2380) ports. It's written in Go, lightweight, and supports proxy and gateway modes for scalability.
For production, configure via flags, YAML files, or systemd units. Always bootstrap with proper initial cluster config to avoid split-brain issues.
CAVEATS
Requires cluster bootstrap; single node unsuitable for production. High disk I/O on writes; monitor alarms. TLS recommended. Avoid running as root.
BOOTSTRAP
Use --initial-cluster with all members for new clusters. Match advertise URLs across nodes.
BACKUP
Use etcdctl snapshot save for consistent backups; restore with etcdutl snapshot restore.
KUBERNETES
Default store for API server. Tune for large clusters: increase --quota-backend-bytes.
HISTORY
Developed by CoreOS in 2013 as Raft-based store. v3.0 (2016) introduced gRPC API, backward-incompatible with v2. Donated to CNCF 2018. Now at v3.5+ with gRPC gateway, better compaction.


