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 1eph5D-0002A5-Hq for pgsql-general@arkaria.postgresql.org; Sat, 24 Feb 2018 21:10:15 +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 1eph5C-0003sS-Eq for pgsql-general@arkaria.postgresql.org; Sat, 24 Feb 2018 21:10:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eph5C-0003sB-7A for pgsql-general@lists.postgresql.org; Sat, 24 Feb 2018 21:10:14 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eph58-0000Kj-Lc for pgsql-general@lists.postgresql.org; Sat, 24 Feb 2018 21:10:13 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id DE6895F79C; Sat, 24 Feb 2018 16:10:08 -0500 (EST) Date: Sat, 24 Feb 2018 16:10:08 -0500 From: Stephen Frost To: Ron Johnson Cc: pgsql-general@lists.postgresql.org Subject: Re: pg_update to a new machine? Message-ID: <20180224211008.GT2416@tamriel.snowman.net> References: <09489f15-b756-9e6d-c081-a8cdf0f9b483@cox.net> <74ef8c30-0db7-84ad-b04e-1975fe2977e4@cox.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="EUyfBRiuaUZ3mDIZ" Content-Disposition: inline In-Reply-To: <74ef8c30-0db7-84ad-b04e-1975fe2977e4@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 --EUyfBRiuaUZ3mDIZ 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: > On 02/24/2018 08:18 AM, Stephen Frost wrote: > >* Ron Johnson (ron.l.johnson@cox.net) wrote: > >>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). >=20 > To set up log shipping on 8.4, I do this, which works well: >=20 > select pg_start_backup('some_meaningful_tag'); > nohup rsync -avz /var/lib/pgsql/data/* postgres@${DESTIP}:/var/lib/pgsql/= data/ & > select pg_stop_backup(); That's not log shipping, for log shipping you need to specify an archive_command and actually capture all of the WAL generated, or, at a minimum, the WAL generated between the start and stop backup calls. Note that the above also doesn't do anything to verify that the data is written out to the disk on the destination side. > Would I, essentially (or in fact), have to set up log shipping from old t= o new? You must capture the WAL generated between the start and stop backup for a backup to be valid. Beyond that, if you want the warm standby to replay the changes made to the primary through WAL, you need to be capturing the WAL generated on the primary using archive_command and then specify a restore_command on the warm standby which will get the WAL segments to be replayed. > >>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. >=20 > I guess that means "yes, set up log shipping"? I'm not sure what you're asking here, but if you wish to minimize downtime, then, yes, set up a warm standby which is being updated through log shipping. > > 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). >=20 > >>Are there better ways?=A0 (The pipe from current DC to new DC will be 1= 0Gbps.) > >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. >=20 > We'll benchmark it. >=20 > > 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 >=20 > Is parallel pg_dump available on 8.4, or am I misinterpreting you? The pg_dump you'll be using is from the version you're upgrading *to*, so it will support parallel jobs. With an 8.4 server, you'll need to stop all write traffic before running the pg_dump and you'll have to specify '--no-synchronized-snapshots' as that's a feature which the 8.4 server doesn't support. Thanks! Stephen --EUyfBRiuaUZ3mDIZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJakdSwAAoJEO1sijiDR2RVPtcP/3OxLAIvlEtpJg2XJBRBPF+x 2b6OmroRftD65ZMAzn9Y+SoXV2J/YslAWSDiV4ABKN8RarsmJvg+MMiHa/oivSgr eGq3mxTy9U6lVpdKCRE2AdWq/3T5jQGxUovXqwxh736AX+vi5LSAtRwtxwt8yC3J nq1wjzBM65RQIvmoa5gT03LUqqykkqgcEeicPE/fHs7dW65aK079cyqtMy44NXTA K8LAKd8kjvqb0qyrQI3cmZKF/NUKsaMZHIn5AbgmiMt54Tpm4WuZRdv77Sxuhqk7 Ulr5cgu15UjhArLoUA273APxrr8W6vcCPoWseeyOWOsieysdM7dM4tmrVwbqMgRD TixvniXsaly1kENGdCKrk0aMwZjJoL/LeFxKGw49yC8ZswrOAIfesvi85i8I/QEv B+fudG/04zVvph7CQKip9m7eeWGZsByQ+cz7cGSOhIxCREVwP9ehH+UpKdZ8J07p CGndigF08HpKLhRcyJSexg0tWu+VBv/Z+NuPDrFJfjIXnbIMU/MRWQVPWZZ3aFYF rZFkSmzSGvOu5TMes5F7zYzsflxmzeCd0NvBJuJVt/Fq8vRTOtVc2P1DRsWX7HdF uYjPos7dPA103OdYBno6hqEnZW6AzCc3bybYWwfmHVkI6BbUymSjwK3TBnnRAxxy S/y+zb7o0NFsFi9/a3A5 =Gyep -----END PGP SIGNATURE----- --EUyfBRiuaUZ3mDIZ--