LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

etcd

distributed key-value store with Raft consensus

TLDR

Start etcd server
$ etcd
copy
Start with custom data directory
$ etcd --data-dir [/var/lib/etcd]
copy
Start with specific listen address
$ etcd --listen-client-urls [http://localhost:2379]
copy
Start with advertised URLs
$ etcd --advertise-client-urls [http://localhost:2379]
copy
Start a cluster member
$ etcd --name [node1] --initial-cluster [node1=http://host1:2380,node2=http://host2:2380]
copy
Enable TLS
$ etcd --cert-file [cert.pem] --key-file [key.pem]
copy

SYNOPSIS

etcd [options]

DESCRIPTION

etcd is a distributed key-value store that provides reliable, consistent data storage for distributed systems. It implements the Raft consensus algorithm to ensure strong consistency across multiple nodes, making it suitable for critical configuration data and service coordination.The server forms the backbone of Kubernetes cluster state management and is used extensively in cloud-native architectures for configuration management, service discovery, and distributed locking. Its simple HTTP/gRPC API and watch functionality enable applications to respond to configuration changes in real-time.etcd prioritizes consistency and availability, making it ideal for storing cluster membership, feature flags, and other distributed system metadata.

PARAMETERS

--name name

Human-readable node name.
--data-dir path
Data directory path.
--listen-client-urls urls
Client listen URLs.
--advertise-client-urls urls
Advertised client URLs.
--listen-peer-urls urls
Peer listen URLs.
--initial-cluster config
Initial cluster configuration.
--initial-cluster-state state
Initial cluster state (new or existing).
--cert-file file
TLS certificate file.
--key-file file
TLS key file.
--initial-cluster-token token
Unique cluster token to prevent cross-cluster interaction.
--initial-advertise-peer-urls urls
Peer URLs to advertise to the rest of the cluster.
--snapshot-count count
Number of committed transactions to trigger a snapshot to disk (default 100000).
--quota-backend-bytes bytes
Raise alarms when backend size exceeds the given quota (0 defaults to low space quota).
--max-request-bytes bytes
Maximum client request size in bytes the server will accept (default 1572864).

CONFIGURATION

/etc/etcd/etcd.conf.yml

Main configuration file for etcd server settings, cluster topology, and security options. Overrides all command-line flags and environment variables when specified.
ETCD_*
Every flag has a corresponding environment variable prefixed with ETCD in all caps and snake case (e.g., --data-dir becomes ETCDDATA_DIR). Command-line flags take precedence over environment variables.

CAVEATS

Requires careful cluster planning for production use. Network partitions affect availability. Disk performance impacts latency. Regular backups essential. Raft consensus requires quorum majority.

HISTORY

etcd was created by CoreOS in 2013 and became a Cloud Native Computing Foundation (CNCF) project. It has become the de facto standard for Kubernetes configuration storage and is widely deployed in production cloud environments.

SEE ALSO

etcdctl(1), kubectl(1), consul(1)

Copied to clipboard
Kai