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 1fBWUR-0002tZ-Cl for pgsql-general@arkaria.postgresql.org; Thu, 26 Apr 2018 02:18:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fBWUQ-000075-Bq for pgsql-general@arkaria.postgresql.org; Thu, 26 Apr 2018 02:18:30 +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.89) (envelope-from ) id 1fBWUQ-00006q-0H for pgsql-general@lists.postgresql.org; Thu, 26 Apr 2018 02:18:30 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fBWUN-0004FT-MQ for pgsql-general@lists.postgresql.org; Thu, 26 Apr 2018 02:18:28 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 64A8321B61; Wed, 25 Apr 2018 22:18:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 25 Apr 2018 22:18:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=RM5YBFdGjC4qg6bghO2Dikfevq65zdlDQTVX+MzwRtE=; b=aYBp1eQx E+YN1LVGux31BlmY17kMzg57ig8qh1JaH3mmvBSOagehNqp6xRz1/3vOW6ryYN0p kN5Z7bm30JENGv7s3BCzr5jHR1E5ezgQKTzitKfaFsetyDlZuWGzkId8dWkqVFkz IuGeKumJxiEIZUwxkN0O/0odzQ5g46AUswl7JhAIwD02ctBeP/nWv0oVisa1CILd 0AJRaIlotkrc46+buPi6VCNiQBlMYfJnvfWKHi3ZSYvtcUe3D9z+sEBcIiBaJYBv KYSwr/ZSkFcYeqU+MLyXarhPXld0GuCS5AczkVWH5W3q2SyuH3NQxzEeK5E7gcjn zysk2KUu2BSAjQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=RM5YBFdGjC4qg6bghO2Dikfevq65z dlDQTVX+MzwRtE=; b=a+tQyvMlry9qn6sJkZl+DTpeBCeGQjoboOfZnt+FoYGF6 pquwPPkNaWIFDvXirNaOZUlT8LkEmTqU3Bw2JUqs8ZRMi/a9jwm3235k+X7Ic1f4 ml485flcWMRPAulWxTVUCjW40IQiQf3dIV++oakLnHvsBwX3b/sxptDiKM5EbMKE kV3k8Jj9QnjKRQ8pLbQZcSaiw0Udfjc+vWSMXc2NEXFLkkavipnb+l+qBgybD3us mFNnrP1+if6zAwDRulO6i49TgQascp4HZcdCncSwlM7VryeMta3+5T1WsoQI1ke2 ggl7cZ2tEwQyzLAZdur8A+jBfrYLkroxB9uXcGBGw== X-ME-Sender: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id 5CDD410253; Wed, 25 Apr 2018 22:18:25 -0400 (EDT) Date: Thu, 26 Apr 2018 11:18:22 +0900 From: Michael Paquier To: Scott Frazer Cc: pgsql-general@lists.postgresql.org Subject: Re: Pulling initial physical replication pg_basebackup from a downstream server Message-ID: <20180426021822.GE18940@paquier.xyz> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="QNDPHrPUIc00TOLW" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --QNDPHrPUIc00TOLW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 25, 2018 at 09:52:47AM -0500, Scott Frazer wrote: > I'm changing out a data center and I need to setup a new replicated serve= r. > The bandwidth speeds between the new data center and the master are slower > than the speeds between the new data center and the current replica. >=20 > Can I get the pg_base_backup from the current replica and then tell the n= ew > server to connect to the master? Taking a base backup from a replica is a supported operation. The base backup taken can then be used to connect to the root primary, even if that's not the server you took the base backup from. Being part of the same cluster is enough (same system ID generated at initialization time).=20 > Would I need to do anything special to > keep the master from discarding the transaction logs needed to come up to > speed? You could create a physical replication slot on the primary, and then take a backup after being sure that the standby has fetched enough WAL to be ahead of the LSN position where the replication slot has been taken. And finally create a recovery.conf in the new replica so as it uses the slot created on the master. You will finish by retaining a bit more WAL than necessary, but a client can request WAL data using a replication slot which is at least the oldest position. Asking for a newer position would cause the replication slot to just not retain anymore the data past the point requested. -- Michael --QNDPHrPUIc00TOLW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlrhNu4ACgkQnvQgOdby QH1biQ//S+6CePJwZYieCF3df8pbp/YQLbhu8I1V12raex7Cw6RPcbez/bCmnKBU HKgAmrunXktfowJSYusLfxbCKC1k2kidbIgihakyru1GVqhog2T2hxZGqyfnne3U E5tyFPhuyWwQdd6hx6DHePR3E0xZkDalAbk/aziSyG5dEEL4PBoKqzQVLj6+hImr VM+wWorSLY8xU0f2t+AzSAyyU3fcMzsi/SXw6IsE5QR7akO15PDDrVurf65UljUk KZiO0jlqlQqz6jmPlnBsUwVaQy1c2D6PgESjz2YfqTPrWgw0Gr4VWMjXlUk169eE 4B/KEyCxIW9FCe367EDzjpDicmBNz5FoalPYAsY84Ja6mI/YGtt6oEXiLFiWnlv9 MTLeHFppkS1LCUrzqj5MdqhTpU5Q4TtjMxtge2ji0UYHy5jdXHByDTZYu6aPKkLX sps+it43XCB6ZLqESL3+CuiRmXUaEWYe5hjTPbOc4TaoZqsyfizqxI+vMgMxGRzg LQMBOmGiUBT5IDzDH8ozKuApV+AwOC5PjPAj1W7dOX2uiOs3n/NB15VF/kgp3+5d eKdQAyDutpmA9nJp0x8jhYwOF4p22+barR3BPKN+Ki0ASwCB14MFQCsrdr1SjWd6 XWDbhyCAJTJX1VQELbO5jom5Tk9cTjQCUTFHuVYZ9jeEkYJaGLQ= =jGF6 -----END PGP SIGNATURE----- --QNDPHrPUIc00TOLW--