Name

crm_resource — Perform tasks related to cluster resources

Synopsis

crm_resource  [-?|-V|-S] -L|-Q|-W|-D|-C|-P|-p [options]

Description

The crm_resource command performs various resource-related actions on the cluster. It can modify the definition of configured resources, start and stop resources, and delete and migrate resources between nodes.

--help, -?

Print the help message.

--verbose, -V

Turn on debug information.

[Note]

Increase the level of verbosity by providing additional instances.

--quiet, -Q

Print only the value on stdout (for use with -W).

Commands

--list, -L

List all resources.

--query-xml, -x

Query a resource.

Requires: -r

--locate, -W

Locate a resource.

Requires: -r

--migrate, -M

Migrate a resource from its current location. Use -N to specify a destination.

If -N is not specified, the resource is forced to move by creating a rule for the current location and a score of -INFINITY.

[Note]

This prevents the resource from running on this node until the constraint is removed with -U.

Requires: -r, Optional: -N, -f

--un-migrate, -U

Remove all constraints created by -M

Requires: -r

--delete, -D

Delete a resource from the CIB.

Requires: -r, -t

--cleanup, -C

Delete a resource from the LRM.

Requires: -r. Optional: -H

--reprobe, -P

Recheck for resources started outside the CRM.

Optional: -H

--refresh, -R

Refresh the CIB from the LRM.

Optional: -H

--set-parameter string, -p string

Set the named parameter for a resource.

Requires: -r, -v. Optional: -i, -s, and --meta

--get-parameter string, -g string

Get the named parameter for a resource.

Requires: -r. Optional: -i, -s, and --meta

--delete-parameter string, -d string

Delete the named parameter for a resource.

Requires: -r. Optional: -i, and --meta

--list-operations string , -O string

List the active resource operations. Optionally filtered by resource, node, or both. Optional: -N, -r

--list-all-operations string , -o string

List all resource operations. Optionally filtered by resource, node, or both. Optional: -N, -r

Options

--resource string, -r string

Specify the resource ID.

--resource-type string, -t string

Specify the resource type (primitive, clone, group, etc.).

--property-value string, -v string

Specify the property value.

--node string, -N string

Specify the hostname.

--meta

Modify a resource's configuration option rahter than one which is passed to the resouce agent script. For use with -p, -g and -d.

--lifetime string, -u string

Lifespan of migration constraints.

--force, -f

Force the resource to move by creating a rule for the current location and a score of -INFINITY

This should be used if the resource's stickiness and constraint scores total more than INFINITY (currently 100,000).

[Note]

This prevents the resource from running on this node until the constraint is removed with -U.

-s string

(Advanced Use Only) Specify the ID of the instance_attributes object to change.

-i string

(Advanced Use Only) Specify the ID of the nvpair object to change or delete.

Examples

Listing all resources:
crm_resource -L
Checking where a resource is running (and if it is):
crm_resource -W -r my_first_ip

If the my_first_ip resource is running, the output of this command reveals the node on which it is running. If it is not running, the output shows this.

Start or stop a resource:
crm_resource -r my_first_ip -p target_role -v started
crm_resource -r my_first_ip -p target_role -v stopped
Query the definition of a resource:
crm_resource -Q -r my_first_ip
Migrate a resource away from its current location:
crm_resource -M -r my_first_ip
Migrate a resource to a specific location:
crm_resource -M -r my_first_ip -H c001n02
Allow a resource to return to its normal location:
crm_resource -U -r my_first_ip
[Note]

The values of resource_stickiness and default_resource_stickiness may mean that it does not move back. In such cases, you should use -M to move it back before running this command.

Delete a resource from the CRM:
crm_resource -D -r my_first_ip -t primitive
Delete a resource group from the CRM:
crm_resource -D -r my_first_group -t group
Disable resource management for a resource in the CRM:
crm_resource -p is-managed -r my_first_ip -t primitive -v off
Enable resource management for a resource in the CRM:
crm_resource -p is-managed -r my_first_ip -t primitive -v on
Reset a failed resource after having been manually cleaned up:
crm_resource -C -H c001n02 -r my_first_ip
Recheck all nodes for resources started outside the CRM:
crm_resource -P
Recheck one node for resources started outside the CRM:
crm_resource -P -H c001n02

Files

/var/lib/heartbeat/crm/cib.xml—the CIB (minus status section) on disk. Editing this file directly is strongly discouraged.

See Also

cibadmin(8), crmadmin(8), lrmadmin(8), heartbeat(8)

Author

crm_resource was written by Andrew Beekhof.