Failback with log shipping

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Failback with log shipping
Date: 2010-05-28 10:58:43
Message-ID: 4BFFA1E3.1000808@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At PGCon, several people asked me about restarting an old master as a
standby after failover has happened. And it wasn't the first time people
ask me about it, even before 9.0. We have no mention of that in the
docs, which is a pretty serious oversight. What can we say about it?

I believe the current official policy is that you have to take a new
base backup and restore from that. Rsync can be used to speed that up.

However, someone once asked me for a comment on a script he wrote to do
that in a smarter way. I forget who and when and how exactly it worked,
but it seems possible to do safely.

First of all, you have to shut down the master cleanly for this to work,
otherwise there can be changes in the old master that never made it to
the standby.

Assuming controlled shutdown and that the standby received all WAL from
the old master before it was promoted, I think you can simply create a
recovery.conf in the old master's data directory to turn it into a
standby server, and restart. Am I missing something?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-05-28 11:17:23 Re: Working with PostgreSQL enums in C code
Previous Message Fujii Masao 2010-05-28 08:46:18 Re: Patch submission deadline for CommitFest 2010-07