Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YdMTC-0005Dy-Rb for pgsql-admin@arkaria.postgresql.org; Wed, 01 Apr 2015 17:30:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YdMTC-0003py-9D for pgsql-admin@arkaria.postgresql.org; Wed, 01 Apr 2015 17:30:26 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YdMTA-0003mF-5q for pgsql-admin@postgresql.org; Wed, 01 Apr 2015 17:30:24 +0000 Received: from imx3.etecsa.cu ([200.55.152.137]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YdMT6-0003Yl-05 for pgsql-admin@postgresql.org; Wed, 01 Apr 2015 17:30:22 +0000 Received: from Unknown ([192.168.91.45] helo=mn3.etecsa.cu) by imx3.etecsa.cu with ESMTP id tCTDu8Ih72637; Wed, 1 Apr 2015 12:29:13 -0500 Received: (qmail 30189 invoked by uid 11185); 1 Apr 2015 18:29:56 -0000 Received: from 192.168.91.6 by mn3.etecsa.cu (envelope-from , uid 502) with qmail-scanner-2.08 (spamassassin: 3.2.5. Clear:RC:1(192.168.91.6):. Processed in 0.027029 secs); 01 Apr 2015 18:29:56 -0000 Received: from unknown (HELO webmail.etecsa.cu) ([192.168.91.6]) (envelope-sender ) by mn2.etecsa.cu (qmail-ldap-1.03) with SMTP for ; 1 Apr 2015 18:29:56 -0000 Received: from 192.168.207.54 (SquirrelMail authenticated user gilberto.castillo) by webmail.etecsa.cu with HTTP; Wed, 1 Apr 2015 13:29:55 -0500 (GMT+5) Message-ID: <38078.192.168.207.54.1427912995.squirrel@webmail.etecsa.cu> In-Reply-To: <551C295D.6060602@evaristesys.com> References: <551C295D.6060602@evaristesys.com> Date: Wed, 1 Apr 2015 13:29:55 -0500 (GMT+5) Subject: Re: Restoring normal master-slave roles after replication failure From: "Gilberto Castillo" To: "Alex Balashov" Cc: pgsql-admin@postgresql.org Reply-To: gilberto.castillo@etecsa.cu User-Agent: SquirrelMail/1.4.8-5.el5_4.10 MIME-Version: 1.0 X-Priority: 3 (Normal) Importance: Normal X-SpamTest-Envelope-From: gilberto.castillo@etecsa.cu X-SpamTest-Info: Profiles 72422 [Jan 28 2015] X-SpamTest-Method: none X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0285], KAS30/SDK/Release X-Anti-Virus: Kaspersky Mail Gateway, version: 5.6.28/RELEASE, bases: 20140401T050822 #7726142, check: 20150401 clean Content-Type: multipart/mixed; boundary="=tCTEuKFe20501=imx3.etecsa.cu=" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org This is a multi-part message in MIME format. --=tCTEuKFe20501=imx3.etecsa.cu= Content-Disposition: inline Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit Hello Alex, Have you seen pgpool or rpmgr-3? > > Hello all, > > I'm terribly sorry if this question has been asked before in a number of > different forms; I wasn't able to find quite the nuance I was looking > for in the archives. > > We're running PostgreSQL 9.4 with streaming replication + hot_standby + > the newfangled physical replication slots. On the master, the > wal_archive level is 'hot_standby', and on the slave, it's 'archive'[1]. > > As I have understood the conventional wisdom from scouring the > documentation and list archives, if the master fails and we > trigger-promote the slave to master and then, after fixing the master > server, we need to restore it to the master role and restore the slave > server back down to the hot_standby role, we need to reinitialise > replication. That is, we need to do a brand new base backup of the slave > back to the master. > > My question is: > > Isn't there a better way that lends itself to some degree of automation? > We have a ~500 GB database and while we can do a base backup, it's > neither pretty nor quick. Can we not configure $OLD_SLAVE as a master > (with WAL senders, replication role and all), put $OLD_MASTER in > recovery mode and have it play out the accumulated WALs in reverse from > $NEW_MASTER, then shut down $NEW_MASTER, reconfigure both replicas to > their appropriate roles, and bring them back up like before? > > If this is possible, does it depend on setting wal_archive to > 'hot_standby' level on the slave during the course of normal operation, > too? Shouldn't 'archive' be sufficient to restore from? What exactly > does the 'hot_standby' WAL level contain that 'archive' doesn't? > > If I'm wrong, is there no other way to do this except to re-do a whole > base backup back to the master? How do people with very large databases > deal with this? Just grin and bear it? > > Many thanks in advance, and I apologise again if this has previously > been answered in some canonical way. > > -- Alex > > [1] This is as it should be, right? We want to have backup WALs in case > we experience a total physical meltdown of the master and need to do > PITR, and/or to archive them to WAL-E from the slave if the slave were > promoted to master. > > -- > Alex Balashov | Principal | Evariste Systems LLC > 303 Perimeter Center North, Suite 300 > Atlanta, GA 30346 > United States > > Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) > Web: http://www.evaristesys.com/, http://www.csrpswitch.com/ > > > -- > Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-admin--- > This message was processed by Kaspersky Mail Gateway 5.6.28/RELEASE > running at host imx2.etecsa.cu > Visit our web-site: , > Saludos, Gilberto Castillo ETECSA, La Habana, Cuba --=tCTEuKFe20501=imx3.etecsa.cu= Content-Type: text/plain Content-Disposition: inline --- This message was processed by Kaspersky Mail Gateway 5.6.28/RELEASE running at host imx3.etecsa.cu Visit our web-site: , --=tCTEuKFe20501=imx3.etecsa.cu= Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin --=tCTEuKFe20501=imx3.etecsa.cu=--