Product SiteDocumentation Site

6.4.2. Plasament Obligatoriu

Mandatory placement occurs any time the constraint’s score is +INFINITY or -INFINITY. In such cases, if the constraint can’t be satisfied, then the rsc resource is not permitted to run. For score=INFINITY, this includes cases where the with-rsc resource is not active.
Dacă aveţi nevoie ca resource1 să ruleze întotdeauna pe aceeaşi maşină ca şi resource2, aţi adăuga următoarea restricţie:
Un exemplu de restricţie de colocare
<rsc_colocation id="colocate" rsc="resource1" with-rsc="resource2" score="INFINITY"/>
Remember, because INFINITY was used, if resource2 can’t run on any of the cluster nodes (for whatever reason) then resource1 will not be allowed to run.
Alternatively, you may want the opposite… that resource1 cannot run on the same machine as resource2. In this case use score="-INFINITY"
Un exemplu de restricţie anti-colocare
<rsc_colocation id="anti-colocate" rsc="resource1" with-rsc="resource2" score="-INFINITY"/>
Din nou, specificând -INFINTY, restricţia este imutabilă. Deci singurul loc rămas pentru a rula este cel unde resource2 este deja, atunci resource1 nu poate rula nicăieri.