Apart from the possibility to configure your cluster resources, the crm tool also allows you to manage existing resources. The following subsections gives you an overview.
When administering a cluster the command crm configure show lists the current CIB objects like cluster configuration, global options, primitives, and others:
root # crm configure show node 178326192: alice node 178326448: bob primitive admin_addr IPaddr2 \ params ip=192.168.2.1 \ op monitor interval=10 timeout=20 primitive stonith-sbd stonith:external/sbd \ params pcmk_delay_max=30 property cib-bootstrap-options: \ have-watchdog=true \ dc-version=1.1.15-17.1-e174ec8 \ cluster-infrastructure=corosync \ cluster-name=hacluster \ stonith-enabled=true \ placement-strategy=balanced \ standby-mode=true rsc_defaults rsc-options: \ resource-stickiness=1 \ migration-threshold=3 op_defaults op-options: \ timeout=600 \ record-pending=true
In case you have lots of resources, the output of show is too verbose. To restrict the output, use the name of the resource. For example, to list the properties of the primitive admin_addr only, append the resource name to show:
root # crm configure show admin_addr primitive admin_addr IPaddr2 \ params ip=192.168.2.1 \ op monitor interval=10 timeout=20
However, in some cases, you want to limit the output of specific resources even more. This can be achieved with filters. Filters limit the output to specific components. For example, to list the nodes only, use type:node:
root # crm configure show type:node node 178326192: alice node 178326448: bob
In case you are also interested in primitives, use the or operator:
root # crm configure show type:node or type:primitive node 178326192: alice node 178326448: bob primitive admin_addr IPaddr2 \ params ip=192.168.2.1 \ op monitor interval=10 timeout=20 primitive stonith-sbd stonith:external/sbd \ params pcmk_delay_max=30
Furthermore, to search for an object that starts with a certain string, use this notation:
root # crm configure show type:primitive and and 'admin*' primitive admin_addr IPaddr2 \ params ip=192.168.2.1 \ op monitor interval=10 timeout=20
To list all available types, enter crm configure show type: and press the Tab key. The Bash completion will give you a list of all types.
To start a new cluster resource you need the respective identifier. Proceed as follows:
Log in as root and start the crm interactive shell:
root # crm
Switch to the resource level:
Start the resource with start and press the Tab key to show all known resources:
crm(live)resource# start ID
A resource will be automatically restarted if it fails, but each failure raises the resource's failcount. If a migration-threshold has been set for that resource, the node will no longer be allowed to run the resource when the number of failures has reached the migration threshold.
Open a shell and log in as user root.
Get a list of all your resources:
root # crm resource list ... Resource Group: dlm-clvm:1 dlm:1 (ocf:pacemaker:controld) Started clvm:1 (ocf:heartbeat:clvm) Started
To clean up the resource dlm, for example:
root # crm resource cleanup dlm
Proceed as follows to remove a cluster resource:
Log in as root and start the crm interactive shell:
root # crm configure
Run the following command to get a list of your resources:
crm(live)# resource status
For example, the output can look like this (whereas myIP is the relevant identifier of your resource):
myIP (ocf:IPaddr:heartbeat) ...
Delete the resource with the relevant identifier (which implies a commit too):
crm(live)# configure delete YOUR_ID
Commit the changes:
crm(live)# configure commit
Although resources are configured to automatically fail over (or migrate) to other nodes of the cluster if a hardware or software failure occurs, you can also manually move a resource to another node using either Hawk2 or the command line.
Use the migrate command for this task. For example, to migrate the resource ipaddress1 to a cluster node named bob, use these commands:
root # crm resource crm(live)resource# migrate ipaddress1 bob
Tags are a way to refer to multiple resources at once, without creating any colocation or ordering relationship between them. This can be useful for grouping conceptually related resources. For example, if you have several resources related to a database, create a tag called databases and add all resources related to the database to this tag:
root # crm configure tag databases: db1 db2 db3
This allows you to start them all with a single command:
root # crm resource start databases
Similarly, you can stop them all too:
root # crm resource stop databases
health status of a cluster or node can be displayed
with so called scripts. A script can perform
different tasks—they are not targeted to health. However, for
this subsection, we focus on how to get the health status.
To get all the details about the health command, use describe:
root # crm script describe health
It shows a description and a list of all parameters and their default values. To execute a script, use run:
root # crm script run health
If you prefer to run only one step from the suite, the describe command lists all available steps in the Steps category.
For example, the following command executes the first step of the health command. The output is stored in the health.json file for further investigation:
root # crm script run health statefile='health.json'
It is also possible to run the above commands with crm cluster health.
For additional information regarding scripts, see http://crmsh.github.io/scripts/.