Operate Etcd cluster

NOTE: This is my perspective aggregation. You can easily find these such of knowledges in the references.

Context

Etcd Version v3.4.0.

Requirements

Number of nodes

CPUs

Memory

Disk

$ fio --rw=write --ioengine=sync --fdatasync=1 --directory=test-data \
    --size=22m --bs=2300 --name=mytest

Network

Tuning

Time parameters

# Command line arguments:
$ etcd --heartbeat-interval=100 --election-timeout=500

# Environment variables:
$ ETCD_HEARTBEAT_INTERVAL=100 ETCD_ELECTION_TIMEOUT=500 etcd

Disk

# best effort, highest priority
$ sudo ionice -c2 -n0 -p `pgrep etcd`

Snapshot

# Command line arguments:
$ etcd --snapshot-count=5000

# Environment variables:
$ ETCD_SNAPSHOT_COUNT=5000 etcd

Maintenance

History compaction

# keep one hour of history
$ etcd --auto-compaction-retention=1 --auto-compaction-mode=periodic

Defragmentation

$ etcdctl defrag

References