On Thu, 2020-03-05 at 17:06 +0000, Virendra Kumar wrote:
> Failover is easy but failback is little bit tricky.
> I have implemented failback by doing following steps:
>
> 1. Start original primary which will be doing crash recovery. It should be designed in such a way that once it is up
applicationshould not start connecting to it otherwise there will be split brain
> and data-mistach between two instances. I implemented it by using a virtual IP mounting on server which is actual
primaryusing keepalived.
> 2. Shutdown original primary and do a pg_rewind to make that as slave for new primary.
> 3. Once slave (original primary) is caught up with primary do failback
> 4. Repeat steps #1-#3 to make failed over instance slave again.
Or you use Patroni and simply say
patronictl.py switchover --candidate db2 --scheduled '2020-03-06 12:00:00' mycluster
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com