From: Stephen Frost <sfrost@snowman.net>
To: Ron Johnson <ron.l.johnson@cox.net>
Cc: pgsql-general@postgresql.org
Subject: Re: pg_update to a new machine?
Date: Sat, 24 Feb 2018 09:18:52 -0500
Message-ID: <20180224141852.GR2416@tamriel.snowman.net> (raw)
In-Reply-To: <09489f15-b756-9e6d-c081-a8cdf0f9b483@cox.net>
References: <09489f15-b756-9e6d-c081-a8cdf0f9b483@cox.net>
Greetings,
* Ron Johnson (ron.l.johnson@cox.net) wrote:
> The 2.8TB database must be moved to a new server in a new Data Center, and
> upgraded from 8.4.17 to 9.6.6
>
> Will this work?
>
> pg_upgrade
> --old-datadir "CURSERVER://var/lib/pgsql/data"
> --new-datadir "NEWSERVER://var/lib/pgsql/data"
> --old-bindir "CURSERVER://usr/bin"
> --new-bindir "NEWSERVER://usr/bin"
No, you can't specify hostnames to pg_upgrade. You could possibly use
NFS or something else to be able to facilitate the above.
> Or must I:
> 1. temporarily allocate 3TB of scratch space on the new server,
If you use --link mode during pg_upgrade, you don't actually need to
allocate that scratch space on the new server.
> 2. install 8.4 on the new server,
> 3. install 9.6.6 on the new server,
For pg_upgrade, you do need both versions installed on the server you're
running pg_upgrade on, yes. Please be sure to use the latest minor
version of each major version if you go that route.
> 2. rsync CURSERVER://var/lib/pgsql/data to
> NEWSERVER://var/lib/pgsql/8.4/data, and then
You can only perform this rsync with the database shut down, just to be
clear. If you wanted to pull the data across with the database online,
you'd need to set up an archive_command and use a tool which works with
8.4 to perform an online backup (such as pgBackRest).
> 3. pg_upgrade?
If you perform an online backup and then capture all of the WAL using
archive_command, you could stand up a warm standby with 8.4 on the new
server which is replaying the WAL as it's generated on the primary by
specifying a restore_command on the new server. Doing this, combined
with using pg_upgrade in --link mode, you would be able to perform the
flip from the old-server-on-8.4 to the new-server-with-9.6 in a
relatively short period of time (on the order of minutes-to-an-hour,
potentially).
> Are there better ways? (The pipe from current DC to new DC will be 10Gbps.)
The above approach would work, but you wouldn't be able to enable
checksums on the new server, which is something I'd certainly recommend
doing if you're able to. To get page-level checksums, you would need to
make sure you initdb the new server with them and then use the newer
pg_dump version to dump the 8.4 data out and then into the 9.6 server.
This could possibly be done as a pipe, but I'd probably find 1TB of
space somewhere and use parallel pg_dump to extract the data out and
into a compressed logical dump and then parallel pg_restore to pull it
into the new server. This would also re-check all constraints in the
system and rebuild all indexes, but would naturally require more
downtime.
Thanks!
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: sfrost@snowman.net, ron.l.johnson@cox.net
Subject: Re: pg_update to a new machine?
In-Reply-To: <20180224141852.GR2416@tamriel.snowman.net>
References: <09489f15-b756-9e6d-c081-a8cdf0f9b483@cox.net> <20180224141852.GR2416@tamriel.snowman.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox