6.3. Colocation of Resources
pcs constraint colocation add [master|slave] source_resource with [master|slave] target_resource [score] [options]
Table 6.3. Properties of a Colocation Constraint
The colocation source. If the constraint cannot be satisfied, the cluster may decide not to allow the resource to run at all.
The colocation target. The cluster will decide where to put this resource first and then decide where to put the source resource.
Positive values indicate the resource should run on the same node. Negative values indicate the resources should not run on the same node. A value of +
6.3.1. Mandatory Placement
-INFINITY. In such cases, if the constraint cannot be satisfied, then the source_resource is not permitted to run. For
score=INFINITY, this includes cases where the target_resource is not active.
myresource1to always run on the same machine as
myresource2, you would add the following constraint:
pcs constraint colocation add myresource1 with myresource2 score=INFINITY
INFINITYwas used, if
myresource2cannot run on any of the cluster nodes (for whatever reason) then
myresource1will not be allowed to run.
myresource1cannot run on the same machine as
myresource2. In this case use
pcs constraint colocation add myresource1 with myresource2 score=-INFINITY
-INFINITY, the constraint is binding. So if the only place left to run is where
myresource2already is, then
myresource1may not run anywhere.