Thread: Replication: re-initialisation of failed master

Replication: re-initialisation of failed master

From
Rob Emery
Date:
Hello all,

We run a 2 node setup replicating between a master and synchronous slave, currently when we want to failover we basically kill the master off, create a recovery file and re-point the traffic via a DNS record etc, we're looking at implementing a corosync/pacemaker setup shortly.

Once we're running with the old secondary as the master the only way we have to re-stage the old master is to use pg_basebackup against the new master to replace the previous master's data directory.

It feels that given how little has probably changed on the new master versus the old master that there should be a faster way of re-initializing the old master as a slave. Is there some sort of short-cut speedup I'm missing here? I suppose I'm mainly curious as to what techniques most admins use to accomplish this!

Thanks in advance
Rob




March Newsletter  - Customers want a high quality ‘clicks & bricks’ F & I experience

Last Month Product Highlights

Codeweavers Ltd | Barn 4 | Dunston Business Village | Dunston | ST18 9AB
Registered in England and Wales No. 04092394 | VAT registration no. 974 9705 63 

Re: Replication: re-initialisation of failed master

From
Guillaume Lelarge
Date:
Hey,

2015-03-03 20:59 GMT+01:00 Rob Emery <re-pgsql@codeweavers.net>:
Hello all,

We run a 2 node setup replicating between a master and synchronous slave, currently when we want to failover we basically kill the master off, create a recovery file and re-point the traffic via a DNS record etc, we're looking at implementing a corosync/pacemaker setup shortly.

Once we're running with the old secondary as the master the only way we have to re-stage the old master is to use pg_basebackup against the new master to replace the previous master's data directory.

It feels that given how little has probably changed on the new master versus the old master that there should be a faster way of re-initializing the old master as a slave. Is there some sort of short-cut speedup I'm missing here? I suppose I'm mainly curious as to what techniques most admins use to accomplish this!


rsync is the usual answer to this kind of issues.


--

Re: Replication: re-initialisation of failed master

From
Vladimir Borodin
Date:
Hi.

3 марта 2015 г., в 22:59, Rob Emery <re-pgsql@codeweavers.net> написал(а):

Hello all,

We run a 2 node setup replicating between a master and synchronous slave, currently when we want to failover we basically kill the master off, create a recovery file and re-point the traffic via a DNS record etc, we're looking at implementing a corosync/pacemaker setup shortly.

Once we're running with the old secondary as the master the only way we have to re-stage the old master is to use pg_basebackup against the new master to replace the previous master's data directory.

It feels that given how little has probably changed on the new master versus the old master that there should be a faster way of re-initializing the old master as a slave. Is there some sort of short-cut speedup I'm missing here? I suppose I'm mainly curious as to what techniques most admins use to accomplish this!

https://github.com/vmware/pg_rewind is the solution for your problem.


Thanks in advance
Rob




March Newsletter  - Customers want a high quality ‘clicks & bricks’ F & I experience

Last Month Product Highlights

Codeweavers Ltd | Barn 4 | Dunston Business Village | Dunston | ST18 9AB
Registered in England and Wales No. 04092394 | VAT registration no. 974 9705 63 



--
May the force be with you…

Re: Replication: re-initialisation of failed master

From
Vladimir Borodin
Date:

4 марта 2015 г., в 11:23, Robert Emery <robertemery@codeweavers.net> написал(а):

That looks like a really cool tool, I've not seen that before! 

Have you used that yourself in a real scenario?

Yes, I do use it for 9.3 and 9.4 in production about a couple of times a month.


On 4 March 2015 at 06:16, Vladimir Borodin <root@simply.name> wrote:
Hi.

3 марта 2015 г., в 22:59, Rob Emery <re-pgsql@codeweavers.net> написал(а):

Hello all,

We run a 2 node setup replicating between a master and synchronous slave, currently when we want to failover we basically kill the master off, create a recovery file and re-point the traffic via a DNS record etc, we're looking at implementing a corosync/pacemaker setup shortly.

Once we're running with the old secondary as the master the only way we have to re-stage the old master is to use pg_basebackup against the new master to replace the previous master's data directory.

It feels that given how little has probably changed on the new master versus the old master that there should be a faster way of re-initializing the old master as a slave. Is there some sort of short-cut speedup I'm missing here? I suppose I'm mainly curious as to what techniques most admins use to accomplish this!

https://github.com/vmware/pg_rewind is the solution for your problem.


Thanks in advance
Rob




March Newsletter  - Customers want a high quality ‘clicks & bricks’ F & I experience

Last Month Product Highlights

Codeweavers Ltd | Barn 4 | Dunston Business Village | Dunston | ST18 9AB
Registered in England and Wales No. 04092394 | VAT registration no. 974 9705 63 



--
May the force be with you…




-- 
Robert Emery
Head of Infrastructure

E: robertemery@codeweavers.net | T: 01785 711633 | W: www.codeweavers.net




March Newsletter  - Customers want a high quality ‘clicks & bricks’ F & I experience

Last Month Product Highlights

Codeweavers Ltd | Barn 4 | Dunston Business Village | Dunston | ST18 9AB
Registered in England and Wales No. 04092394 | VAT registration no. 974 9705 63 



--
May the force be with you…