Re: PITR - warm standby switchover question - Mailing list pgsql-general

From Chander Ganesan
Subject Re: PITR - warm standby switchover question
Date
Msg-id 49E5E602.6020605@otg-nc.com
Whole thread Raw
In response to Re: PITR - warm standby switchover question  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-general
Fujii Masao wrote:
> Hi,
>
> On Wed, Apr 15, 2009 at 9:23 AM, Dan Hayes <dhayes501@gmail.com> wrote:
>
>> Excellent!  Thanks.  One other quick question...  What would happen if I
>> didn't delete the recovery.conf file?  Is that step just to prevent
>> accidentally restarting the server with it there?
>>
>
> recovery.conf is automatically renamed recovery.done by
> postgres at the end of recovery, which would prevent
> accidentally restarting warm-standby. So, you don't need to
> delete or rename recovery.conf by hand after recovery.
>
Also, keep in mind that the ideal solution is not to create a stop file,
but to get the last few WAL files that had not been archived prior to
the main system going down and place them in the directory that
pg_standby was copying files from.  If you simply create a stopfile and
have the system start up, you're likely to lose some transactions that
were in any WAL files that had not yet been archived (at the very least,
that's the currently-in-use WAL file at the time of the crash).  While
getting these files isn't always possible, the best practice would be to
at least try...  There are a variety of ways to provide for real-time
replication of in-use WAL files, if losing transactions in a crash is
not a viable option for you..

Once you've gotten the last few WAL's, you should see PostgreSQL
automatically detect the end of WAL logs and start up - with or without
the stopfile (so you can still create the stopfile)

Once the server has completed recovery, it won't come up in recovery
again, since (as Fujii noted) PostgreSQL will rename recovery.conf to
recovery.done - indicating that recovery has completed.  It will also
begin a new timeline, etc.

Generally speaking, after recovery completes, you probably want to
create a warm-standby backup and then log subsequent WAL files to ease
future recovery from WAL's on the "currently active" cluster.

--
Chander Ganesan
Open Technology Group, Inc.
One Copley Parkway, Suite 210
Morrisville, NC  27560
919-463-0999/877-258-8987
http://www.otg-nc.com
Ask me about Expert PostgreSQL, PostGIS, and other Open Source training delivered worldwide!


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: a question about postgresql server connection
Next
From: Chander Ganesan
Date:
Subject: Re: backup getting larger and larger