Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 3C99AB5DE78 for ; Tue, 7 Jun 2011 22:11:49 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 20415-04 for ; Wed, 8 Jun 2011 01:11:41 +0000 (UTC) X-Greylist: delayed 00:08:14.40977 by SQLgrey-1.7.6 Received: from qmta12.emeryville.ca.mail.comcast.net (qmta12.emeryville.ca.mail.comcast.net [76.96.27.227]) by mail.postgresql.org (Postfix) with ESMTP id 38522B5E0E3 for ; Tue, 7 Jun 2011 22:11:41 -0300 (ADT) Received: from omta16.emeryville.ca.mail.comcast.net ([76.96.30.72]) by qmta12.emeryville.ca.mail.comcast.net with comcast id tD0J1g0011ZMdJ4ACD3QK3; Wed, 08 Jun 2011 01:03:24 +0000 Received: from homie ([68.45.149.190]) by omta16.emeryville.ca.mail.comcast.net with comcast id tD391g00r46izrY8cD3AA1; Wed, 08 Jun 2011 01:03:11 +0000 Received: by homie (Postfix, from userid 1000) id 6C167181821; Tue, 7 Jun 2011 20:53:45 -0400 (EDT) To: Simon Riggs Cc: Ray Stell , A J , Kevin Grittner , pgsql-admin Subject: Re: Switchover of Master and Slave roles References: <693391.31715.qm@web120020.mail.ne1.yahoo.com> <20110607181244.GA3861@cns.vt.edu> <264025.13168.qm@web120005.mail.ne1.yahoo.com> <4DEE2B49020000250003E2A2@gw.wicourts.gov> <349220.32155.qm@web120008.mail.ne1.yahoo.com> <20110607194139.GB3861@cns.vt.edu> From: Jerry Sievers Date: Tue, 07 Jun 2011 20:53:45 -0400 In-Reply-To: (Simon Riggs's message of "Tue\, 7 Jun 2011 20\:46\:47 +0100") Message-ID: <87k4cx9m92.fsf@comcast.net> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.355 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=1.553, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RFC_ABUSE_POST=0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/41 X-Sequence-Number: 37667 Simon Riggs writes: > On Tue, Jun 7, 2011 at 8:41 PM, Ray Stell wrote: > >> On Tue, Jun 07, 2011 at 11:59:07AM -0700, A J wrote: >>> We then rely on filesystem tools (or other third party tools) to get the >>> original master in sync with the new master efficiently and then make it join as >>> slave. >> >> the doc would not be corrupted by an additional few words that stated as such: >> >> "To return to normal operation, a standby server must be recreated using >> external tools such as rsync, either on the former primary system when >> it comes up, or on a third, possibly new, system." > > You need repmgr: http://www.repmgr.org/ Well, I am not sure on the 9.x versions but, we used to do reversible master/standby with log shipping on the 8.x versions quite routinely, sometimes reshaping clusters of multiple standbys., designating a new master, restarting the old master in recovery mode and repointing the remaining standbys.. The procedure was similar to... apps down and locked out pg_rotate_xlog() on master verify final log received on standbys and consumed bring up new master kill immediate on old master and remaining standbys configure old master as standby w/recovery.conf and point to new xlog repository repoint other standbys to new repository and restart There was no need to reinitialize from scratch or rsync the old master or other standbys. Somewhere between 8.2 and 8.4 there was a change that would require you to increment the recovery target timeline during this operation. It took me a bit of head scratching to get it right. This capability was apparently little known and used, perhaps due to uncertainty that it was viable, given the undocumented nature of this. Disclaimer: I do not know if this still works on 9.x using either log shipping or streaming replication. I covered this strategy briefly during my talk at the 2010 Pg-East conference in Philly. YMMV > -- >  Simon Riggs                   http://www.2ndQuadrant.com/ >  PostgreSQL Development, 24x7 Support, Training & Services > > -- > Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-admin > -- Jerry Sievers Postgres DBA/Development Consulting e: gsievers19@comcast.net p: 305.321.1144