Re: Safe switchover

2020-07-13 Thread Jehan-Guillaume de Rorthais
On Fri, 10 Jul 2020 10:05:52 +1000 James Sewell wrote: > Hi all, > > I’m trying to work out a procedure for a safe zero data loss switchover > under (high) load, which allows the old master to be reconnected without > the use of pgrewind. > > Would the following be sane? > > - open connection

Re: Safe switchover

2020-07-13 Thread Stephen Frost
Greetings, * Paul Förster (paul.foers...@gmail.com) wrote: > > On 13. Jul, 2020, at 18:00, Stephen Frost wrote: > > Ah, yes, if you rebuild the replica from a backup (or from the primary), > > then sure, that's pretty similar to the pgbackrest delta restore, except > > that when using delta resto

Re: Safe switchover

2020-07-13 Thread Paul Förster
Hi Stephen, > On 13. Jul, 2020, at 18:00, Stephen Frost wrote: > > A pgbackrest delta restore will scan the entire data directory and > verify every file matches the last backup, or it'll replace the file > with what was in the backup that's being used. If there's an error > during any of that,

Re: Safe switchover

2020-07-13 Thread Stephen Frost
Greetings, * Paul Förster (paul.foers...@gmail.com) wrote: > > On 13. Jul, 2020, at 17:47, Stephen Frost wrote: > > > > Sure, Patroni will handle the failover fine- but that's not what I was > > referring to. If the server crashes and you have no idea why or what > > happened, I would strongly

Re: Safe switchover

2020-07-13 Thread Paul Förster
Hi Stephen, > On 13. Jul, 2020, at 17:47, Stephen Frost wrote: > > Sure, Patroni will handle the failover fine- but that's not what I was > referring to. If the server crashes and you have no idea why or what > happened, I would strongly recommend against using pg_rewind to rebuild > it to be a

Re: Safe switchover

2020-07-13 Thread Stephen Frost
Greetings, * Paul Förster (paul.foers...@gmail.com) wrote: > > On 10. Jul, 2020, at 17:45, Stephen Frost wrote: > > Sure, if you know exactly why the former primary failed and have > > confidence that nothing actually bad happened then pg_rewind can work > > (though it's still not what I'd genera

Re: Safe switchover

2020-07-10 Thread Paul Förster
Hi Stephen, > On 10. Jul, 2020, at 17:45, Stephen Frost wrote: > > Sure, if you know exactly why the former primary failed and have > confidence that nothing actually bad happened then pg_rewind can work > (though it's still not what I'd generally recommend). > > If you don't actually know what

Re: Safe switchover

2020-07-10 Thread Stephen Frost
Greetings, * Paul Förster (paul.foers...@gmail.com) wrote: > > On 10. Jul, 2020, at 17:29, Stephen Frost wrote: > > Patroni also has the option to use pgbackrest instead of pg_rewind. > > right. Sorry, I forgot about that. We use pg_rewind which works great. Sure, if you know exactly why the fo

Re: Safe switchover

2020-07-10 Thread Paul Förster
Hi Stephen, > On 10. Jul, 2020, at 17:29, Stephen Frost wrote: > > Patroni also has the option to use pgbackrest instead of pg_rewind. right. Sorry, I forgot about that. We use pg_rewind which works great. Cheers, Paul

Re: Safe switchover

2020-07-10 Thread Stephen Frost
Greetings, * Paul Förster (paul.foers...@gmail.com) wrote: > I wouldn't work out the procedure myself, especially since there is a free > working solution already. It's dangerous if you do it yourself and make a > mistake. > > In our company, we rely on Patroni (https://github.com/zalando/patro

Re: Safe switchover

2020-07-10 Thread Paul Förster
Hi James, I wouldn't work out the procedure myself, especially since there is a free working solution already. It's dangerous if you do it yourself and make a mistake. In our company, we rely on Patroni (https://github.com/zalando/patroni). Yes, it uses pg_rewind in the background but it does

Re: Safe switchover

2020-07-10 Thread James Sewell
> - open connection to database > - smart shutdown master > - terminate all other connections > - wait for shutdown (archiving will finish) > OK despite what it looked like from the code - upon testing it seems like even a fast shutdown will wait for logs to be archived *as long as progress is bei

Safe switchover

2020-07-09 Thread James Sewell
Hi all, I’m trying to work out a procedure for a safe zero data loss switchover under (high) load, which allows the old master to be reconnected without the use of pgrewind. Would the following be sane? - open connection to database - smart shutdown master - terminate all other connections - wai