Move resources in a cluster
Move cluster resources manually between nodes or configure automatic relocation based on failure thresholds and connectivity changes.
About this task
Move resources manually in a cluster using the pcs resource move and pcs resource relocate commands, as described in Manually moving cluster resources. Additionally, control resource placement and behavior by disabling, enabling, or banning resources, as described in Disabling, enabling, and banning cluster resources.
Resources can also be configured to move automatically to a new node after a specified number of failures or when external network connectivity is lost.
Moving resources due to failure
When creating a resource, configure it to move to a new node after a specified number of failures by setting the migration-threshold resource option. When the threshold is reached, the node cannot run the failed resource until:
- The
failure-timeoutvalue of the resource expires. - An administrator manually resets the resource failure count using the
pcs resource cleanupcommand.
The default value of migration-threshold is INFINITY, which is defined internally as a large but finite number. Setting migration-threshold to 0 disables the feature.
Setting a migration-threshold for a resource differs from configuring live resource migration, where a resource moves to another node without state loss.
The following command adds a migration threshold of 10 to the dummy_resource resource, causing it to move to a new node after 10 failures:
# pcs resource meta dummy_resource migration-threshold=10
To add a migration threshold to the defaults for the entire cluster, run the following command:
# pcs resource defaults update migration-threshold=10
To check current resource failure status and limits, run the pcs resource failcount show command.
Two exceptions apply to the migration threshold concept: start failures and stop failures. If the start-failure-is-fatal cluster property is set to true (the default), a start failure immediately sets the failure count to INFINITY and moves the resource. For details about cluster properties, see Summary of cluster properties and options.
If a resource fails to stop and STONITH is enabled, the cluster fences the node to allow the resource to start elsewhere. If STONITH is disabled, the cluster cannot migrate the resource and retries stopping it after the failure timeout.
Moving resources due to connectivity changes
Configuring a cluster to move resources when external connectivity is lost is a two-step process:
- Add a
pingresource to the cluster. Thepingresource checks whether specified machines (by host name or IP address) are reachable and maintains thepingdnode attribute. - Configure a location constraint rule to move resources to a connected node when connectivity is lost.
The following table describes the properties of a ping resource.
| Field | Description |
|---|---|
|
|
The time to wait (dampening) before applying connectivity changes. This prevents resources from rapidly flapping across the cluster if nodes detect connection changes at slightly different times. |
|
|
The factor multiplied by the number of connected ping targets to generate a score. Useful when multiple ping targets are configured. |
|
|
A space-separated list of resolvable DNS host names, IPv4 addresses, or IPv6 addresses to contact to determine connectivity. |
The following example procedure creates a ping resource that checks connectivity to gateway.example.com. In production environments, specify the network gateway or router address.