[ClusterLabs] multi-state constraints

Andrei Borzenkov arvidjaar at gmail.com
Mon May 10 12:17:59 EDT 2021


On 10.05.2021 16:50, Alastair Basden wrote:
> Hi,
> 
> We have a 4 node cluster, on which we want a drbd service to run
> master/slave on 2 nodes (with 1 of those preferred as the master).  It
> should not be started at all on the other 2 nodes.
> 
> To set this up, we've done:
> pcs resource create resourcedrbd0 ocf:linbit:drbd drbd_resource=disk0 op
> monitor interval=60s
> pcs resource master resourcedrbd0Clone resourcedrbd0 master-max=1
> master-node-max=1 clone-max=2 clone-node-max=1 notify=true
> 
> I think we need to constrain the resource:
> pcs constraint location resourcedrbd0 prefers node1=100
> pcs constraint location resourcedrbd0 prefers node2=50
> pcs constraint location resourcedrbd0 avoids node3
> pcs constraint location resourcedrbd0 avoids node4
> 
> Do we also need to constrain the clone?:

No, only one set is needed. I am not sure what is preferred, but you can
use either primitive or clone in resource constraints.

> pcs constraint location resourcedrb0Clone prefers node1=100
> pcs constraint location resourcedrb0Clone prefers node2=50

Those two constraints are redundant and they do not do what you expect.
Location constraints are not related to master selection. They just
define which nodes are eligible to run clone instance; which instance
will be promoted is defined by master score which is usually set by
resource agent.

You can define rules to set master score, but I do not know how it will
interact with explicit scores set by other means.

> pcs constraint location resourcedrb0Clone avoids node3
> pcs constraint location resourcedrb0Clone avoids node4
> 
> Is this correct, or should I be using a colocation somehow?
> 
> 
> Do I also need:
> pcs constraint order demote resourcedrbd0 then promote resourcedrbd0    ?
> I think probably not.
> 
> For the file system resource that will then I think we should use this:
> pcs constraint colocation add resourceFilesystem with resourcedrbd0Clone
> INFINITY with-rsc-role=Master
> pcs constraint order promote resourcedrbd0Clone then start
> resourceFilesystem
> 
> Is that correct?  I'm not sure about the with-rsc-role=Master part.
> 
> Thanks,
> Alastair.
> _______________________________________________
> Manage your subscription:
> https://lists.clusterlabs.org/mailman/listinfo/users
> 
> ClusterLabs home: https://www.clusterlabs.org/



More information about the Users mailing list