pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Scott Frazer <sfrazer@couponcabin.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Pulling initial physical replication pg_basebackup from a downstream server
Date: Thu, 26 Apr 2018 11:18:22 +0900
Message-ID: <20180426021822.GE18940@paquier.xyz> (raw)
In-Reply-To: <CA+ey=a=4wGy1PFady1VyXVhfFGJQ22W=RowdOSyeshZBquQ9Rg@mail.gmail.com>
References: <CA+ey=a=4wGy1PFady1VyXVhfFGJQ22W=RowdOSyeshZBquQ9Rg@mail.gmail.com>

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 server.
> 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.
> 
> Can I get the pg_base_backup from the current replica and then tell the new
> 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). 

> 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

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (2+ messages)

Message-ID: <20180426021822.GE18940@paquier.xyz>
Permalink:  ../20180426021822.GE18940@paquier.xyz/
Also on:    postgresql.org/message-id/20180426021822.GE18940@paquier.xyz

 · 

reply

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: michael@paquier.xyz, sfrazer@couponcabin.com
  Subject: Re: Pulling initial physical replication pg_basebackup from a downstream server
  In-Reply-To: <20180426021822.GE18940@paquier.xyz>
  References: <CA+ey=a=4wGy1PFady1VyXVhfFGJQ22W=RowdOSyeshZBquQ9Rg@mail.gmail.com> <20180426021822.GE18940@paquier.xyz>

* 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