postgresql_cluster
postgresql_cluster copied to clipboard
Implement zero-downtime major upgrades (blue/green)
In the previous release (1.8.0), we introduced automation for in place major upgrades with minimal downtime (see PR #301).
While this was a significant improvement, there is still a need for a solution that enables zero-downtime upgrades.
Proposed Enhancement:
To achieve zero downtime during major PostgreSQL upgrades, we need to implement a feature that utilizes pg_upgrade on a standby cluster.
This approach involves the following steps (in short, without details):
- Setting up a standby cluster (with pg_basebackup or from backup);
- Synchronize the standby cluster with the source cluster using physical replication;
- Create logical replication slot on the source database (and save LSN);
- Promote the target cluster to LSN from logical replication slot;
- Perform
pg_upgradeon the target cluster; - Synchronize the target cluster with the source cluster using logical replication (apply changes);
- Perform a switchover to target cluster with near-zero downtime;
- Configure reverse logical replication for the possibility of rollback without data loss.
This method will allow us to perform major version upgrades without impacting the availability of the PostgreSQL service. With the ability to quickly rollback without losing the latest changes.
If you're interested in this feature, please consider becoming a sponsor.
The development of this feature requires sponsorship to fund developer efforts. If you're already a sponsor and are interested in this feature, please leave a comment here so we can prioritize this issue accordingly.
We also welcome contributions from those willing to dedicate their time to implement this feature on a voluntary basis. Please see the Contributing Guide for more information.