Re: Streaming replication upgrade sanity check

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: tsuraan <tsuraan(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Streaming replication upgrade sanity check
Date: 2021-03-11 02:22:32
Message-ID: 20210311022232.GA11270@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Sat, Feb 13, 2021 at 10:02:20AM -0600, tsuraan wrote:
> I have several streaming replication pairs running under postgres 10,
> and I'm looking at upgrading them to postgres 13. Doing that on the
> active side is pretty quick and easy: just run pg_upgrade once for
> each of versions 11, 12, and 13, then start things up again. That's
> tested (on non-replicated instances) and seems to be working great.
> The standby side looks a little bit more interesting, so I wanted some
> feedback about whether my approach looks safe.
>
> It looks like the most correct approach would be to discard the
> standby systems and just do a new pg_basebackup, but quite a few of
> the pairs have a standby on AWS and limited upstream bandwidth, so the
> basebackup can take several days. I'd like to avoid that if I can.
>
> So, my thought is to just upgrade the active side as normal, and once
> that's done and the master is back in use, stop the standby's
> postgres, call "pg_start_backup(...)" on the master, rsync the changed
> files from the running master's data dir to the standby's 10.x data
> directory, call "pg_stop_backup()", migrate the recovery.conf into a
> postgresql.auto.conf, touch the standby.signal file, and then start
> the new postgres 13 on the standby. That seems to work, but I want to
> be sure I'm not just having good luck due to the relatively low
> activity on my test systems.
>
> I use named replication slots with my streaming replication, so I
> think that the rsync'd pg_wal directory should have everything I need
> (or maybe this isn't guaranteed?), and the pg_start/stop_backup will
> ensure that all the damage done by rsync'ing an active database can be
> repaired from the pg_wal files that rsync fetches. Are those
> assumptions right, or am I missing anything else? Is this idea
> workable at all?

Did you see the pg_upgrade instructions on upgrading standby servers?
Why are you not using that?

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

The usefulness of a cup is in its emptiness, Bruce Lee

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message J T 2021-03-11 06:20:56 Pg_stat_activity question
Previous Message David G. Johnston 2021-03-10 15:48:01 Re: partition table insert error!