Example 6.14. Chain of colocated resources
<constraints> <rsc_colocation id="coloc-1" rsc="D" with-rsc="C" score="INFINITY"/> <rsc_colocation id="coloc-2" rsc="C" with-rsc="B" score="INFINITY"/> <rsc_colocation id="coloc-3" rsc="B" with-rsc="A" score="INFINITY"/> </constraints>
B
is not able to run, then both C
and by inference D
must also remain stopped. Here is an example resource_set
:
Example 6.15. Equivalent colocation chain expressed using resource_set
<constraints> <rsc_colocation id="coloc-1" score="INFINITY" > <resource_set id="colocated-set-example" sequential="true"> <resource_ref id="A"/> <resource_ref id="B"/> <resource_ref id="C"/> <resource_ref id="D"/> </resource_set> </rsc_colocation> </constraints>
Important
A B
may be equivalent to A with B
, or B with A
.
sequential
property).
A
, B
, and C
will each be colocated with D
. D
must be active, but any of A
, B
, or C
may be inactive without affecting any other resources.
Example 6.16. Using colocated sets to specify a common peer
<constraints> <rsc_colocation id="coloc-1" score="INFINITY" > <resource_set id="colocated-set-1" sequential="false"> <resource_ref id="A"/> <resource_ref id="B"/> <resource_ref id="C"/> </resource_set> <resource_set id="colocated-set-2" sequential="true"> <resource_ref id="D"/> </resource_set> </rsc_colocation> </constraints>
Important
sequential=false
makes sense only if there is another set in the constraint. Otherwise, the constraint has no effect.
sequential="true"
, then in order for one member of that set to be active, all members listed before it must also be active.
role
property.
Example 6.17. Colocation chain in which the members of the middle set have no interdependencies, and the last listed set (which the cluster places first) is restricted to instances in master status.
<constraints> <rsc_colocation id="coloc-1" score="INFINITY" > <resource_set id="colocated-set-1" sequential="true"> <resource_ref id="B"/> <resource_ref id="A"/> </resource_set> <resource_set id="colocated-set-2" sequential="false"> <resource_ref id="C"/> <resource_ref id="D"/> <resource_ref id="E"/> </resource_set> <resource_set id="colocated-set-3" sequential="true" role="Master"> <resource_ref id="G"/> <resource_ref id="F"/> </resource_set> </rsc_colocation> </constraints>
Note
B
is colocated with A
, but colocated-set-1
is colocated with colocated-set-2
.
require-all
option.