Configuration
Before deployment, define the etcd cluster in the configuration inventory. Typical choices are:
- 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 etcd cluster can have an even number of members. It has the same failure tolerance as a cluster with one fewer member. The extra member increases deployment and quorum costs. Thus, production clusters usually have one, three, or five members. Clusters with more than five members 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
To define a single etcd instance in Pigsty, use one line of configuration:
All single-node configuration templates include this line. The configuration process replaces placeholder IP 10.10.10.10 with the current admin node IP.
Only etcd_seq and etcd_cluster are required. Together, these parameters uniquely identify each etcd instance.
Three Nodes
The most common configuration has 3 etcd nodes. It tolerates 1 node failure and is suitable for small and medium production environments.
Example: Pigsty’s 3-node templates trio and safe use 3-node etcd:
Five Nodes
A 5-node cluster tolerates 2 node failures. It is suitable for large production environments.
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 |
After a permanent etcd membership change, reload the related service configurations. This updates the endpoints that services use to access etcd.
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 enables etcd RBAC authentication by default. Related parameters:
| Parameter | Description | Default |
|---|---|---|
etcd_root_password | etcd root password | Etcd.Root |
pg_etcd_password | Patroni’s password for etcd | Empty (uses cluster name) |
Production recommendations:
Filesystem Layout
The module creates these directories and 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 |
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)