[ClusterLabs] multi-state constraints

Alastair Basden a.g.basden at durham.ac.uk
Mon May 10 09:50:38 EDT 2021


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?:
pcs constraint location resourcedrb0Clone prefers node1=100
pcs constraint location resourcedrb0Clone prefers node2=50
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.


More information about the Users mailing list