Chapter 8. Managing Cluster Resources
8.1. Manually Moving Resources Around the Cluster
- When a node is under maintenance, and you need to move all resources running on that node to a different node
- When individually specified resources needs to be moved
- You can use the
pcs resource movecommand to move a resource off a node on which it is currently running, as described in Section 8.1.1, “Moving a Resource from its Current Node”.
- You can use the
pcs resource relocate runcommand to move a resource to its preferred node, as determined by current cluster status, constraints, location of resources and other settings. For information on this command, see Section 8.1.2, “Moving a Resource to its Preferred Node”.
8.1.1. Moving a Resource from its Current Node
destination_nodeif you want to indicate on which node to run the resource that you are moving.
pcs resource move resource_id [destination_node] [--master] [lifetime=lifetime]
pcs resource movecommand, this adds a constraint to the resource to prevent it from running on the node on which it is currently running. You can execute the
pcs resource clearor the
pcs constraint deletecommand to remove the constraint. This does not necessarily move the resources back to the original node; where the resources can run at that point depends on how you have configured your resources initially.
--masterparameter of the
pcs resource movecommand, the scope of the constraint is limited to the master role and you must specify master_id rather than resource_id.
lifetimeparameter for the
pcs resource movecommand to indicate a period of time the constraint should remain. You specify the units of a
lifetimeparameter according to the format defined in ISO 8601, which requires that you specify the unit as a capital letter such as Y (for years), M (for months), W (for weeks), D (for days), H (for hours), M (for minutes), and S (for seconds).
lifetimeparameter of 5M indicates an interval of five months, while a
lifetimeparameter of PT5M indicates an interval of five minutes.
lifetimeparameter is checked at intervals defined by the
cluster-recheck-intervalcluster property. By default this value is 15 minutes. If your configuration requires that you check this parameter more frequently, you can reset this value with the following command.
pcs property set cluster-recheck-interval=value
--wait[=n]parameter for the
pcs resource movecommand to indicate the number of seconds to wait for the resource to start on the destination node before returning 0 if the resource is started or 1 if the resource has not yet started. If you do not specify n, the default resource timeout will be used.
example-node2and prevents it from moving back to the node on which it was originally running for one hour and thirty minutes.
pcs resource move resource1 example-node2 lifetime=PT1H30M
example-node2and prevents it from moving back to the node on which it was originally running for thirty minutes.
pcs resource move resource1 example-node2 lifetime=PT30M
8.1.2. Moving a Resource to its Preferred Node
pcs resource relocate run [resource1] [resource2] ...
pcs resource relocate runcommand, you can enter the
pcs resource relocate clearcommand. To display the current status of resources and their optimal node ignoring resource stickiness, enter the
pcs resource relocate showcommand.