[Pacemaker] Prioritized failover

Florian Haas florian at hastexo.com
Thu Nov 17 03:16:44 EST 2011


On 11/17/11 08:03, Nirmala S wrote:
> Hi,
> 
>  
> 
> I am in the process of modeling high availability for DB using
> Pacemaker. DB is an in-memory one with optional storage on disk.
> Replication is used as main form of data communication between nodes.
> The cluster needs to have a master-preferred slave-other slaves. Master
> and preferred slave replicate synchronously. Preferred slave acts as
> replication master for other slaves. In case of failure of master, the
> preferred slave should become master and pick one of the other slaves to
> handle the preferred slave role.
> 
>  
> 
> Topology is
> 
>  
> 
> Master
> 
>    |
> 
> Slave/Master
> 
>      /  |  \
> 
> Slave Slave Slave

You can easily test this with the "Stateful" resource agent. Say you've
got 5 nodes, alice, bob, charlie, daisy and eric. alice is meant to be
your central master, bob is a slave to alice and a master to the three
others. alice and bob should be able to switch roles.

The following example configuration is untested, but it should suffice
to illustrate the idea.

node alice attributes class="central"
node bob attributes class=central"
node charlie attributes class="satellite"
node daisy attributes class="satellite"
node eric attributes class="satellite"

primitive p_stateful1 ocf:pacemaker:Stateful
primitive p_stateful2 ocf:pacemaker:Stateful
ms ms_stateful1 p_stateful1 meta master-max=1 clone-max=2
ms ms_stateful2 p_stateful2 meta master-max=1 clone-max=4

location l_stateful1_on_central ms_stateful1 \
  rule -inf: class ne central
location l_stateful2_master_on_central ms_stateful2 \
  rule $role=Master -inf: class ne central
location l_stateful2_slave_on_satellite ms_stateful2 \
  rule $role=Slave -inf: class ne satellite
colocation c_stateful2_master_on_stateful1_slave
  inf: ms_stateful2:Master ms_stateful1:Slave

> It needs to be achieved by one resource agent. Should the prioritized
> failover be based on ordering or location preference ? In either case
> based on the replication lag, can it be set dynamically ?

Take a look at what ocf:heartbeat:mysql and ocf:linbit:drbd do with
crm_master. It will allow you to set a master preference in whatever way
you see fit.

Cheers,
Florian

-- 
Need help with High Availability?
http://www.hastexo.com/now




More information about the Pacemaker mailing list