Pacemaker Constraints

How to display, add and remove Pacemaker resource constraints

Pacemaker Constraints

Add a location constraint using this command:

$ pcs constraint location VIP-10.11.12.99 prefers 10.11.12.200=50

Display any current constraints with this:

$ pcs constraint --full

Location Constraints:
  Resource: VIP-10.11.12.99
    Enabled on: 10.11.12.200 (score:50) (id:location-VIP-10.11.12.99-10.11.12.200-50)
  Resource: VIP-10.11.12.100
    Enabled on: 10.11.12.220 (score:50) (id:location-VIP-10.11.12.100-10.11.12.220-50)
Ordering Constraints:
Colocation Constraints: 

Or this:

$ crm_resource -a -r resource_name

* VIP-10.11.12.99
  : Node 10.11.12.10
 (score=-INFINITY, id=cli-ban-VIP-10.11.12.99-on-10.11.12.10)
  : Node 10.11.12.11
 (score=50, id=location-VIP-VIP-10.11.12.99-10.11.12.10-50)

Remove a constraint like so:

$ pcs constraint remove rule_id

Or with this:

$ crm_resource --un-move --resource resource_name