RE: Resync second slave to new master - Mailing list pgsql-general

From Dylan Luong
Subject RE: Resync second slave to new master
Date
Msg-id aac57117a27e440a864abe81f297c05f@ITUPW-EXMBOX3B.UniNet.unisa.edu.au
Whole thread Raw
In response to Re: Resync second slave to new master  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Resync second slave to new master  (Michael Paquier <michael@paquier.xyz>)
List pgsql-general
Thanks Michael,
So everytime after promoting Slave to become master (either manually or automatic), just stop Slave2 and run pg_rewind
onslave2 against the new maser (old slave1). And when old master server is available again, use pg_rewind on that serve
aswell against new master to return to original configuration. 

-----Original Message-----
From: Michael Paquier [mailto:michael@paquier.xyz]
Sent: Tuesday, 6 March 2018 3:54 PM
To: Dylan Luong <Dylan.Luong@unisa.edu.au>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Resync second slave to new master

On Tue, Mar 06, 2018 at 04:45:10AM +0000, Dylan Luong wrote:
> After a failover (promote) to the Slave1,  is it easily resync the
> Slave2 to the new master (old slave1)? Do we need to do  full rebuild
> of the Slave2 from new master everytime we failover to Slave1 from
> Master? Can we use pg_rewind on Slave2 to resyn it with new master
> (old slave1)?

After promoting slave 1, it could be possible that some records have slipped to slave 2 from the primary.  In this
case,a rewind would be recommended.  You should be careful that your slave 2 has not received WAL to a position newer
thanwhere WAL has forked because of the promotion.  If that happened, then a rewind would be necessary before
repluggingslave 2 to the newly-promoted server.  Be very careful with your failover flow here.  pg_rewind also would
notrun if it finds that the target server does not need a rewind, so you could stop the slave 2, and run pg_rewind
unconditionallyto keep things simple. 
--
Michael


pgsql-general by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Resync second slave to new master
Next
From: Benjamin Scherrey
Date:
Subject: Re: Best options for new PG instance