Product SiteDocumentation Site

6.4. Placing Resources Relative to other Resources

When the location of one resource depends on the location of another one, we call this colocation.
There is an important side-effect of creating a colocation constraint between two resources, that it affects the order in which resources are assigned to a node. If you think about it, its somewhat obvious. You can't place A relative to B unless you know where B is [8]. So when you are creating colocation constraints, it is important to consider whether you should colocate A with B or B with A.
Another thing to keep in mind is that, assuming A is collocated with B, the cluster will also take into account A's preferences when deciding which node to choose for B. For a detailed look at exactly how this occurs, see the Colocation Explained document.

6.4.1. Options

Table 6.3. Properties of a Collocation Constraint
Field Description
id A unique name for the constraint
rsc The colocation source. If the constraint cannot be satisfied, the cluster may decide not to allow the resource to run at all.
with-rsc The colocation target. The cluster will decide where to put this resource first and then decide where to put the resource in the rsc field
score Positive values indicate the resource should run on the same node. Negative values indicate the resources should not run on the same node. Values of +/- INFINITY change "should" to "must".



[8] While the human brain is sophisticated enough to read the constraint in any order and choose the correct one depending on the situation, the cluster is not quite so smart. Yet.