Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lKAyJ-0001ef-OA for pgsql-admin@arkaria.postgresql.org; Thu, 11 Mar 2021 02:22:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lKAyI-00089J-Cv for pgsql-admin@arkaria.postgresql.org; Thu, 11 Mar 2021 02:22:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lKAyI-00089C-4p for pgsql-admin@lists.postgresql.org; Thu, 11 Mar 2021 02:22:42 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lKAyA-0003H3-FK for pgsql-admin@postgresql.org; Thu, 11 Mar 2021 02:22:40 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1lKAy8-0004W9-Dl; Wed, 10 Mar 2021 21:22:32 -0500 Date: Wed, 10 Mar 2021 21:22:32 -0500 From: Bruce Momjian To: tsuraan Cc: pgsql-admin@postgresql.org Subject: Re: Streaming replication upgrade sanity check Message-ID: <20210311022232.GA11270@momjian.us> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 https://momjian.us EDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee