[Pacemaker] Multi-node resource dependency

Andrew Beekhof andrew at beekhof.net
Mon Jul 22 02:57:47 UTC 2013


On 20/07/2013, at 7:18 AM, Lars Ellenberg <Lars.Ellenberg at linbit.com> wrote:

> On Fri, Jul 19, 2013 at 04:49:21PM +0200, "Tomcsányi, Domonkos" wrote:
>> Hello everyone,
>> 
>> I have been struggling with this issue for quite some time so I
>> decided to ask you to see if maybe you can shed some light on this
>> problem.
>> So here is the deal:
>> I have a 4-node cluster, from which 2-2 nodes belong together.
>> In ASCII art it would look like this:
>> 
>> --------------         --------------
>> | NODE1 |    --   | NODE 2  |
>> --------------         --------------
>> |                         |
>> |                         |
>> |                         |
>> --------------         --------------
>> | NODE 3 |  --  | NODE 4 |
>> --------------         --------------
>> 
>> Now the behaviour I would like to achieve:
>> If NODE 1 goes offline its services should get migrated to NODE 2
>> AND NODE 3's services should get migrated to NODE 4.
>> If NODE 3 goes offline its services should get migrated to NODE4 AND
>> NODE1's services should get migrated to NODE 2.
>> Of course the same should happen vice versa with NODE 2 and NODE 4.
>> 
>> The services NODE1 and 2 are the same naturally, but they differ
>> from NODE 3's and 4's services. So I added some 'location'
>> directives to the config so the services can only be started on the
>> right nodes.
>> I tried 'colocation' which is great, but not for this kind of
>> behaviour: if I colocate both resource groups of NODE 1 and 3 only
>> one of them starts (of course, because colocation means the
>> resource/resource group(s) should be running on the same NODE, so my
>> location directives kick in and prevent for example NODE 3's
>> services from starting on NODE 1).
>> 
>> So my question is: is it possible to define such behaviour I
>> described above in Pacemaker? If yes, how?
> 
> You may use node attributes in colocation constraints.
> 
> So you would give your nodes attributes, first:
> 
> crm node
> 	attribute NODE1 set color pink
> 	attribute NODE3 set color pink
> 
> 	attribute NODE2 set color slime
> 	attribute NODE4 set color slime
> 
> crm configure
> 	colocation c-by-color inf: rsc_a rsc_b rsc_c node-attribute=color

I had totally forgotten about that feature :-)
What a good idea!

> 
> The "implicit default" node-attribute is #uname ...
> so using "color" the resources only need to run on nodes with the same
> value for the node-attribute "color".
> 
> 	Lars
> 
> -- 
> : Lars Ellenberg
> : LINBIT | Your Way to High Availability
> : DRBD/HA support and consulting http://www.linbit.com
> 
> DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
> 
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
> 
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org





More information about the Pacemaker mailing list