Re: Upgrade Failover Cluster

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Upgrade Failover Cluster
Date: 2025-12-04 13:57:30
Message-ID: CANzqJaA7NOamDoVLpc478BuxXMMEjiCAJUvHHdwUY5P63LQPSw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Dec 4, 2025 at 2:00 AM BUBACZ Martin <martin(dot)bubacz(at)axa(dot)com> wrote:

> Hi All,
>
>
>
> I’m fairly new to postgresql and I have a question concerning upgrading a
> 2 node failover physical replication cluster. I’m automating the cluster
> installation and maintenance by using Puppet. All runs good so far.
>
>
>
> When it comes to an upgrade scenario, let’s say upgrading from rel. 16.x
> to 17.x, I’m unsure if it is required to upgrade primary first and then
> replica or if order doesn’t matter. I’ve read different statements in some
> articles on internet about it. One said it’s possible to upgrade replica
> first by using pg_upgrade or rebuilding replica from primary by
> pg_basebackup and others are telling me primary first.
>
>
>
> What is the recommended/most stable path to upgrade a cluster? I would
> appreciate if you could shed some light on this? Thanks beforehand.
>

One standard low-downtime practice is:to do *logical* replication from the
Primary to the Secondary. Then promote the Secondary to be the New
Primary, and do a pg_basebackup from it back to the Old Primary.

The other low- (but not as low) downtime method is to stop replication, and
pg_upgrade the Primary. (It's fast with the --link option, but there's no
going back once you start the upgraded instance.) Then pg_basebackup to
the Secondary as normal.

Last is to stop replication and then do a normal pg_upgrade. It's still
fast, but copies all data to a new directory, but that "fast" is relative
to how big your data is.

Which you choose depends on how much downtime you can get and (since LR
doesn't replicate DDL and sequences) how often the DDL changes.

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2025-12-04 19:55:08 Extract only maximum date from column
Previous Message BUBACZ Martin 2025-12-04 06:59:52 Upgrade Failover Cluster