Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aRndJ-0006qB-LG for pgsql-admin@arkaria.postgresql.org; Fri, 05 Feb 2016 21:09:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aRndI-0004La-Tz for pgsql-admin@arkaria.postgresql.org; Fri, 05 Feb 2016 21:09:36 +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) (envelope-from ) id 1aRndI-0004LT-Ew for pgsql-admin@postgresql.org; Fri, 05 Feb 2016 21:09:36 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aRndB-0006Ch-D1 for pgsql-admin@postgresql.org; Fri, 05 Feb 2016 21:09:36 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 66B165F795; Fri, 5 Feb 2016 16:09:28 -0500 (EST) Date: Fri, 5 Feb 2016 16:09:28 -0500 From: Stephen Frost To: Dave Johansen Cc: pgsql-admin@postgresql.org Subject: Re: Setting up streaming replication with new server as master? Message-ID: <20160205210928.GB3331@tamriel.snowman.net> References: <20160205202729.GZ3331@tamriel.snowman.net> <20160205205456.GA3331@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="9Za+rIOv72GXlfHR" Content-Disposition: inline In-Reply-To: X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-61-generic (x86_64) X-Uptime: 16:07:25 up 185 days, 5:37, 8 users, load average: 0.01, 0.07, 0.11 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org --9Za+rIOv72GXlfHR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Dave Johansen (davejohansen@gmail.com) wrote: > On Fri, Feb 5, 2016 at 1:54 PM, Stephen Frost wrote: > > * Dave Johansen (davejohansen@gmail.com) wrote: > > > So will pg_basebackup keep copying the new data that is added over the > > > weekend until I tell it to stop? If so, then on Monday, can I close > > things > > > down, wait for the WAL to finish, swap the roles of the 2 server and = then > > > restart? > > > > No, pg_basebackup will take a snapshot of the current system, > > essentially. You can set up the new system to connect to the current > > system, using recovery.conf, to pull the WAL records and apply them to > > the new server. > > >=20 > So do I set that up before running pg_basebackup? >=20 > Or in other words, pg_basebackup will get all of the existing data and th= en > the setup using recovery.conf will get the new data? Right. Note that to use pg_basebackup or to have a replica connect to the existing system, you need to have archive_mode set to archive or higher (and you should at least do hot_standby, really), and have max_wal_senders set higher than 0 (I tend to set it to about 3, just because it uses little in the way of resources, etc). If you have a high transaction rate, you might also want to set wal_keep_segments up a bit. Thanks! Stephen --9Za+rIOv72GXlfHR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJWtQ+IAAoJEO1sijiDR2RVjEMP/0162pHqqn1kMB/poVht+oO2 pbt54JAgMMYbXf5/8TdGMAiZVuNW5V5jUywMHPuHlLA5FjeMsCoxrO9epVK4QYAT rCH+MnSGLeytxuZ2Cyxho3qXatKESHgbxzKUpgGx0mPevzzgVUn2d5hmi959yGjV bDRz+773av3afI0zJVNAU5b7KN6wZu0mfWSwGCxgaUNxODOuucwQFAHEg6bnhqjp +yxeINISh/r2cp+oLYgb7P0I8giJoiJfizaiFg9Q0rUF+IK4qlmkhhw/i0ctruMf 4QtHvFUOz6YDhqCKiA6jptdMwWCUP0bjSUvp84DgTwnRGjhQDoF7vq7SNIfbeAWz L9+Y82jiT/JrvAQP/uiyfeCP8h4ZK4XD1ZGWfkjnedFQy1CiVFZRiFvBVQQTdVQx UK3xjx31To7zHSUBl3+XbPkv6p1KyE0Q3zxOTyjd0obSNRiDeBI/P0ZxcpyXE7yL 7JWl157tF8s9nEgpqH+jNKp/RlBLOl3eCZ5w4bX0s1EidWDZL8/meBU0WBXsv/ho kFg/7Vxb21xTgDTX8iQ6z6yWxkne8FnPhIPeFa4iq4T5Yy3FnMcPqBRY03gDT05E sbGn2Y52sQpMR/wUmOQc3pjHW86vLoqD+fy7RCr78yT4nsxhwIGHAfS3XKA1/6d9 Un5pQiulO1/I4NwWcr9d =GgrH -----END PGP SIGNATURE----- --9Za+rIOv72GXlfHR--