Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1epafG-000059-NR for pgsql-general@arkaria.postgresql.org; Sat, 24 Feb 2018 14:19:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1epafF-0007Wd-Ao for pgsql-general@arkaria.postgresql.org; Sat, 24 Feb 2018 14:19:01 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1epafE-0007VH-Uu for pgsql-general@lists.postgresql.org; Sat, 24 Feb 2018 14:19:01 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1epaf7-0006mV-5i for pgsql-general@postgresql.org; Sat, 24 Feb 2018 14:18:58 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 33A8E5F79C; Sat, 24 Feb 2018 09:18:52 -0500 (EST) Date: Sat, 24 Feb 2018 09:18:52 -0500 From: Stephen Frost To: Ron Johnson Cc: pgsql-general@postgresql.org Subject: Re: pg_update to a new machine? Message-ID: <20180224141852.GR2416@tamriel.snowman.net> References: <09489f15-b756-9e6d-c081-a8cdf0f9b483@cox.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="T6cqijbRiMJ38whr" Content-Disposition: inline In-Reply-To: <09489f15-b756-9e6d-c081-a8cdf0f9b483@cox.net> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --T6cqijbRiMJ38whr Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 >=20 > Will this work? >=20 > 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?=A0 (The pipe from current DC to new DC will be 10G= bps.) 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 --T6cqijbRiMJ38whr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJakXRLAAoJEO1sijiDR2RVEN0P/2X1efb9cSYWn5cacpVJzFNT +P/21/hgIowy+xJumKxNicVnlCbeAaX9LeYrmXKdZOIJ1vU/52u2Psz5N34AwL7P G1ahZCpTJ3SHkZLA3/kKRw2BRydcbicdeQtL5t8qI158u4UJ2vhGMj4eaoq4hnso /97ga68VyL/fI7n/DuG6XIeiYIbCLsh8bZXTrxIq5O360z2fzORsbrRoDyq2nqlb ucXvEJonybw/NZ5da6Oh+dsZyBy1yJNjepKZHlLxITfqjchFFEUjH/iJsPlEsqvZ JhhJfUJNevj/iCSWMFMtV6HMex4VZqzTy+rBW3sqVUO0IamH4txxi6pTAtctDKIt tjp+A6WMooeSSg5bKM7L4L2pRyP9vPAJxD6/LgnFbmxw07iG97zfgdWSRk86XcId 05Bs3Xf4rH52YjG6a85rWlhi0e9WUzk1U1B5WpDYh+508IJd3/ii0U68qHXjoyEZ 5nno25WpCAOm7K5muxWLpbsSHMNJC3bB27yMpHYlBrF+7hQYs82UovoDNVy+rikP tQTH66qxuz37VZAuSeHXQZ8SduXIyuVjQJqOp2mnJK6rtYVYvxBxgTkjR9xAFnDS KfLp4sv2O7kQm5JGQRgl8qLAtYZqW5JQtDt2ssBfCJPV3ZVsMZamB6xarlFhXwjk VjXUP5VBvToHo0aX8kSz =jI49 -----END PGP SIGNATURE----- --T6cqijbRiMJ38whr--