On Thu, Dec 4, 2025 at 2:00 AM BUBACZ Martin <[email protected]> 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!

Reply via email to