Configuration
Before deployment, define etcd cluster in config inventory. Typical choices:
- One Node: No HA, suitable for dev, test, demo, or standalone deployments using external S3 backup for PITR
- Three Nodes: Basic HA, tolerates 1 node failure, suitable for small-medium prod
- Five Nodes: Better HA, tolerates 2 node failures, suitable for large prod
An even-member Etcd cluster is technically valid, but it does not tolerate more failures than an odd-member cluster with one fewer member, while increasing deployment and quorum cost. Production therefore usually uses one, three, or five members; clusters larger than five are uncommon.
| Cluster Size | Quorum | Fault Tolerance | Use Case |
|---|---|---|---|
| 1 node | 1 | 0 | Dev, test, demo |
| 3 nodes | 2 | 1 | Small-medium prod |
| 5 nodes | 3 | 2 | Large prod |
| 7 nodes | 4 | 3 | Special HA requirements |
One Node
Define singleton etcd instance in Pigsty—single line of config:
All single-node config templates include this line. Placeholder IP 10.10.10.10 replaced with current admin node’s IP.
Only required params: etcd_seq and etcd_cluster—uniquely identify each etcd instance.
Three Nodes
Most common config: 3-node etcd cluster tolerates 1 node failure, suitable for small-medium prod.
Example: Pigsty’s 3-node templates trio and safe use 3-node etcd:
Five Nodes
5-node cluster tolerates 2 node failures, suitable for large prod.
Example: Pigsty’s production simulation template ha/simu uses a 5-node etcd cluster:
Services Using etcd
Services using etcd in Pigsty:
| Service | Purpose | Config File |
|---|---|---|
| Patroni | PG HA, stores cluster state and config | /etc/patroni/patroni.yml |
| VIP-Manager | Binds L2 VIP on PG clusters | /etc/default/vip-manager.yml |
When etcd cluster membership changes permanently, reload related service configs to ensure correct access.
Update Patroni’s etcd endpoint ref:
Update VIP-Manager’s etcd endpoint ref (only for PGSQL L2 VIP):
RBAC Authentication Config
Since v4.0, Pigsty has enabled etcd RBAC auth by default. Related params:
| Parameter | Description | Default |
|---|---|---|
etcd_root_password |
etcd root password | Etcd.Root |
pg_etcd_password |
Patroni’s password for etcd | Empty (uses cluster name) |
Prod recommendations:
Filesystem Layout
Module creates these directories/files on target hosts:
| Path | Purpose | Permissions |
|---|---|---|
/etc/etcd/ |
Config dir | 0750, etcd:etcd |
/etc/etcd/etcd.conf |
Main config file | 0644, etcd:etcd |
/etc/etcd/etcd.pass |
Root password file | 0640, root:etcd |
/etc/etcd/ca.crt |
CA cert | 0644, etcd:etcd |
/etc/etcd/server.crt |
Server cert | 0644, etcd:etcd |
/etc/etcd/server.key |
Server private key | 0600, etcd:etcd |
/var/lib/etcd/ |
Backup data dir | 0770, etcd:etcd |
/data/etcd/ |
Main data dir (configurable) | 0700, etcd:etcd |
/etc/profile.d/etcdctl.sh |
Client env vars | 0644, root:root |
/etc/systemd/system/etcd.service |
Systemd service | 0644, root:root |