Some CRM Shell Command

These are some notes about crm shell command to be used managing cluster.
This article is not a “guide” or an “how to’s” but it is just a collection of messy notes.

Main config file:

/etc/ha.d/ha.cf
/var/lib/heartbeat/crm/cib.xml (editable using crm)

Cluster Status:

#crm_mon
============
Last updated: Fri Mar 22 12:49:14 1975
Stack: Heartbeat
Current DC: server-bob (aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa) - partition with quorum
Version: 1.0.12-unknown
2 Nodes configured, 2 expected votes
3 Resources configured.
============

Online: [ server-bob server-alice ]

 Clone Set: ping_clone
     Started: [ server-alice server-bob ]
 Master/Slave Set: ms_drbd
     Masters: [ server-bob ]
     Slaves: [ server-alice ]
 Resource Group: cluster_zenoss
     fs_drbd    (ocf::heartbeat:Filesystem):    Started server-bob
     ClusterIP  (ocf::heartbeat:IPaddr2):       Started server-bob
     ClusterIP_ADMIN    (ocf::heartbeat:IPaddr2):       Started server-bob
     mysqld     (lsb:mysqld):   Started server-bob
     apache     (ocf::heartbeat:apache):        Started server-bob
     zenoss     (lsb:zenoss):   Started server-bob

CRM shell

To access crm command line, just type crm

#crm
crm(live)#

help command will show you lot of command you may use

crm(live)# help
This is the CRM command line interface program.

Available commands:

cib manage shadow CIBs
resource resources management
node nodes management
options user preferences
configure CRM cluster configuration
ra resource agents information center
status show cluster status
quit,bye,exit exit the program
help show help
end,cd,up go back one level

any command bring you to another level of commands.
For example typing “resource” you get the command to manage resoureces:

crm(live)# resource (accedo alla gestione delle risorse)
crm(live)resource# help 
crm(live)resource# list 
crm(live)resource# status

If you need to temporary remove resource (unmanage  and manage) and then enable it again:

crm(live)resource# unmanage resource_name
crm(live)resource# manage resource_name

Migrate resource from a node to another

crm(live)resource# migrate resource_name

End command moves you to the upper level.
Here are some node commands

crm(live)# node 
crm(live)node#

Standyby node, enable node, switch-off node (fence):

crm(live)node# standby nodename
crm(live)node# online nodename
crm(live)node# fence nodename

Configure comand is useful to show config file o edit it:

crm(live)# configure
crm(live)configure# show
crm(live)configure# edit

If you write some change in config file you need to save it (ctrl+w or ctrl+x) and then commit changes:

crm(live)configure# commit

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.