Video in progress
How do you keep the versions, settings and extensions of 50 PostgreSQL clusters consistent and manageable?
I manage the clusters as code, not by hand: configuration templates (Terraform, Ansible or a Kubernetes operator), cluster profiles (small/medium/large), drift detection, a version policy and automatic upgrades. Every cluster must have an owner and an inventory record.
📖 Answer
If 50 clusters are managed by hand, after a year every one of them is unique: on one, someone changed work_mem at night, one has no backup configured, three are on an unsupported version. And during an incident, nobody can answer "what's different about this cluster?".
The system I build:
-
Inventory. For each cluster: the owner (team), criticality level, version, size, RPO/RTO, extensions. This is collected automatically, not in Excel.
-
Profiles. Parameters come from the profile and the server size:
profile: oltp-medium
postgres_version: 17
parameters:
shared_buffers: "25%"
max_connections: 200
statement_timeout: 30s
idle_in_transaction_session_timeout: 60s
extensions: [pg_stat_statements, pgcrypto]
backup: { full: weekly, wal_archive: true, retention_days: 30 }
If an exception is needed, it goes through a PR, with a reason.
-
Drift detection. Every day the actual
pg_settingsis compared with the expected configuration; a difference becomes a ticket. -
Version policy. A new major version comes out every year, and each is supported for 5 years. The rule: "no older than N-2", and minor updates every quarter. There's one automated upgrade runbook, tried first on non-critical clusters.
-
Unified monitoring. The same dashboards and alerts for every cluster; a new cluster isn't created without them.
On Kubernetes, CloudNativePG or a similar operator; on VMs, Ansible + Patroni. For a managed service, Terraform modules and parameter groups. Whatever the tool, the goal is the same: creating a new cluster and upgrading 50 of them should each be one command.
Sign up to mark studied questions and save your progress.