Thread: fixing failed master after standby promotion

fixing failed master after standby promotion

From
Aviel Buskila
Date:
Hey ,
I have been setting a configuration of 2 nodes (master and standby) replicating using repmgr, and 1 server using for load balancing using pgpool-II.
Now after the master has failed, the standby was successfully promoted.
I would like to know if there is any elegant way to semi-automatically resync the failed master and re-register him as a standby server?


Thanks in advance,
Aviel Buskila.

Re: fixing failed master after standby promotion

From
Masahiko Sawada
Date:
On Sun, Aug 7, 2016 at 10:55 PM, Aviel Buskila <aviel33@gmail.com> wrote:
> Hey ,
> I have been setting a configuration of 2 nodes (master and standby)
> replicating using repmgr, and 1 server using for load balancing using
> pgpool-II.
> Now after the master has failed, the standby was successfully promoted.
> I would like to know if there is any elegant way to semi-automatically
> resync the failed master and re-register him as a standby server?
>

I'm not familiar with repmgr but you can use the pg_rewind in order to
automatically synchronize a data cluster if you use PostgreSQL 9.5 or
later.
In 9.4 or before, you need to take whole backup from the new master
server, for example using pg_basebackup.

Regards,

--
Masahiko Sawada


Re: fixing failed master after standby promotion

From
Michael Paquier
Date:
On Mon, Aug 8, 2016 at 11:35 AM, Masahiko Sawada <sawada.mshk@gmail.com> wrote:
> On Sun, Aug 7, 2016 at 10:55 PM, Aviel Buskila <aviel33@gmail.com> wrote:
>> Hey ,
>> I have been setting a configuration of 2 nodes (master and standby)
>> replicating using repmgr, and 1 server using for load balancing using
>> pgpool-II.
>> Now after the master has failed, the standby was successfully promoted.
>> I would like to know if there is any elegant way to semi-automatically
>> resync the failed master and re-register him as a standby server?
>>
>
> I'm not familiar with repmgr but you can use the pg_rewind in order to
> automatically synchronize a data cluster if you use PostgreSQL 9.5 or
> later.
> In 9.4 or before, you need to take whole backup from the new master
> server, for example using pg_basebackup.

Note that this needs wal_log_hints to be set to on so as pages having
their hint bints modified get WAL-logged after a checkpoint so as
pg_rewind is able to track such pages. pg_rewind has been integrated
if Postgres core in 9.5, but note that I spend some time maintaining a
version of pg_rewind for 9.3 and 9.4 [1], and it is proving to be in a
rather stable state. I got that integrated into some of the things I
work on, and nobody complains about it.

[1]: https://github.com/vmware/pg_rewind
--
Michael