Re: Setting up streaming replication with new server as master? - Mailing list pgsql-admin

From Keith
Subject Re: Setting up streaming replication with new server as master?
Date
Msg-id CAHw75vteoQ21uGmOF4WxwoDBC_NTRoKOKvJrj0Prt-Dw_ixxEg@mail.gmail.com
Whole thread Raw
In response to Re: Setting up streaming replication with new server as master?  (Dave Johansen <davejohansen@gmail.com>)
Responses Re: Setting up streaming replication with new server as master?
List pgsql-admin


On Wed, Feb 17, 2016 at 10:02 AM, Dave Johansen <davejohansen@gmail.com> wrote:
On Sat, Feb 6, 2016 at 6:38 PM, John Scalia <jayknowsunix@gmail.com> wrote:
If you specify -X f or more likely -X s, that will cause pg_basebackup to include the WAL files that were written after you started the operation. Since you're setting up a replica, use the -X s option as that's for streaming.

I ran pg_basebackup with -X s and it finished in the middle of the night last night. I would now like to make the switch, but what's the best way to copy over the records that have been inserted since the backup stopped?

The -Xs option just keeps the WAL files that were written during the backup run so that if you restore it, it's brought back up to a consistent state at the point when the backup itself finished.

If you want to be able to bring up a slave from a backup at any point after that backup was complete, you have to keep all the WAL files that have been written since then. This is what is called Point-In-Time Recovery (PITR). I highly recommend you read up on the docs for how WAL files in postgres work and how to use them with backups and slaves. I think that is a key point your missing in understanding how to get a streaming slave set up and working.


pgsql-admin by date:

Previous
From: Dave Johansen
Date:
Subject: Re: Setting up streaming replication with new server as master?
Next
From: Ray Stell
Date:
Subject: Re: oracle db reads from postgresql