[ClusterLabs Developers] migrate-to and migrate-from for moving Master/Slave roles ?

Andrei Borzenkov arvidjaar at gmail.com
Mon Nov 30 22:36:35 EST 2015

26.11.2015 03:52, Jehan-Guillaume de Rorthais пишет:
> Hi guys,
> While working on our pgsqlms agent[1], we are now studying how to control all
> the steps of a switchover process from the resource agent. 
> The tricky part here is the 2nd step of a successful swithover with PostgreSQL
> (9.3+):
>   (1) shutdown the master first
>   (2) make sure the designated slave received **everything** from the old master

I am not familiar with PG, but it sounds backwards. Once master
(replication source) is shut down, there is no way to verify anything on
slave (replication target) side. Is there any way to tell PG to "prepare
to switch" and wait until it is complete on demote?

Or do you mean waiting until slave finished replaying pending
replication stream? In this case I expect it should be possible to check
on slave side (something like "we have 5 files to replay left")?

>   (3) promote the designated slave as master
>   (4) start the old master as slave
> As far as we understand Pacemaker, migrate-to and migrate-from capabilities
> allows to distinguish if we are moving a resource because of a failure or for a
> controlled switchover situation. Unfortunately, these capabilities are ignored
> for cloned and multi-state resources...
> Because of this restriction, we currently don't know from the resource agent
> code if we should check the designated slave received everything from the old
> master (controlled switchover) or not (we lost the master). In case of
> controlled switchover, if the designated slave did not received everything from
> the master, we must abort the switchover.
> A workaround we could imagine would be to set a special cluster attribute
> manually (using crm_attribute) to signal the agent we are going to make a
> controlled switchover.
> But I bet the cleaner way would be to use migrate-to and migrate-from
> capabilities. Did we miss something about them? Is there some plan to support
> moving a Master/Slave role using migrate-to and migrate-from at some point? Any
> other proposal? ideas?
> [1] see "multistate" folder in https://github.com/dalibo/pgsql-resource-agent
> Regards,

More information about the Developers mailing list