Re: pg_upgrade and rsync

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_upgrade and rsync
Date: 2015-01-29 05:26:11
Message-ID: 54C9C473.8080201@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> So, for my 2c, I'm on the fence about it. On the one hand, I agree,
> it's a bit of a complex process to get right. On the other hand, it's
> far better if we put something out there along the lines of "if you
> really want to, this is how to do it" than having folks try to fumble
> through to find the correct steps themselves.

So, here's the correct steps for Bruce, because his current doc does not
cover all of these. I really think this should go in as a numbered set
of steps; the current doc has some steps as steps, and other stuff
buried in paragraphs.

1. Install the new version binaries on both servers, alongside the old
version.

2. If not done by the package install, initdb the new version's data
directory.

3. Check that the replica is not very lagged. If it is, wait for
traffic to die down and for it to catch up.

4. Shut down the master using -m fast or -m smart for a clean shutdown.
It is not necessary to shut down the replicas yet.

5. pg_upgrade the master using the --link option. Do not start the new
version yet.

6. create a data directory for the new version on the replica. This
directory should be empty; if it was initdb'd by the installation
package, then delete its contents.

7. shut down postgres on the replica.

8. rsync both the old and new data directories from the master to the
replica, using the --size-only and -H hard links options. For example,
if both 9.3 and 9.4 are in /var/lib/postgresql, do:

rsync -aHv --size-only -e ssh --itemize-changes /var/lib/postgresql/
replica-host:/var/lib/postgresql/

9. Create a recovery.conf file in the replica's data directory with the
appropriate parameters.

10. Start the master, then the replica

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2015-01-29 06:51:03 Re: jsonb, unicode escapes and escaped backslashes
Previous Message Matt Kelly 2015-01-29 05:18:09 Exposing the stats snapshot timestamp to SQL