vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on "Patroni" and DCS "etcd" or "consul"). Automating with Ansible.
MIT License
1.29k stars 352 forks source link

TODO: Implement Zero-Downtime Major Upgrades #537

Open vitabaks opened 4 months ago

vitabaks commented 4 months ago

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):

  1. Setting up a standby cluster (with pg_basebackup or from backup)
  2. Synchronize the standby cluster with the main cluster using physical replication.
  3. Perform pg_upgrade on the standby cluster.
  4. Synchronize the standby cluster with the main cluster using logical replication (apply changes).
  5. Perform a switchover to new cluster and (optionally) configure reverse logical replication.

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.


Consider sponsoring the project via GitHub or Patreon