Cluster Resource Management
CRM Shell is used for Linux Cluster management. We can use “crm configure” with “group, order, location, colocation, …” parameters and “crm resource” with “start, stop, status, migrate, cleanup, …“.
The following examples cover the basic Linux Cluster resource management commands you might find useful. Additional help is available by executing “crm configure help” or “crm resource help” command.
Our current Linux Cluster resource configuration is:
[root@node1 ~]# crm configure show
node node1
node node2
primitive Apache ocf:heartbeat:apache
params configfile="/etc/httpd/conf/httpd.conf"
op monitor interval="30s"
op start timeout="40s" interval="0"
op stop timeout="60s" interval="0"
primitive ClusterIP ocf:heartbeat:IPaddr2
params ip="192.168.1.150" cidr_netmask="24"
op monitor interval="30s"
property $id="cib-bootstrap-options"
dc-version="1.1.10-1.el6_4.4-368c726"
cluster-infrastructure="classic openais (with plugin)"
expected-quorum-votes="2"
stonith-enabled="false"
last-lrm-refresh="1383902488"
Group Linux Cluster Resources “crm configure group groupname resource1 resource2″
Group your Linux Cluster resources and start/stop and manage your resource group with one single command.
[root@node1 ~]# crm configure group HTTP-GROUP ClusterIP Apache
[root@node1 ~]# crm configure show
node node1
node node2
primitive Apache ocf:heartbeat:apache
params configfile="/etc/httpd/conf/httpd.conf"
op monitor interval="30s"
op start timeout="40s" interval="0"
op stop timeout="60s" interval="0"
primitive ClusterIP ocf:heartbeat:IPaddr2
params ip="192.168.1.150" cidr_netmask="24"
op monitor interval="30s"
group HTTP-GROUP ClusterIP Apache
property $id="cib-bootstrap-options"
dc-version="1.1.10-1.el6_4.4-368c726"
cluster-infrastructure="classic openais (with plugin)"
expected-quorum-votes="2"
stonith-enabled="false"
last-lrm-refresh="1383902488"
In this example we created a resource group called HTTP-GROUP with ClusterIP and Apache resources. We can now manage all our grouped resources by starting, stopping and managing HTTP-GROUP group resource.
Linux Cluster Resources Start/Stop Order “crm configure order ordername inf: resource1 resource2:start“
With this command we can configure start and stop order of our Linux Cluster resources.
[root@node1 ~]# crm configure order ClusterIP-before-Apache inf: ClusterIP Apache:start
[root@node1 ~]# crm configure show
node node1
node node2
primitive Apache ocf:heartbeat:apache
params configfile="/etc/httpd/conf/httpd.conf"
op monitor interval="30s"
op start timeout="40s" interval="0"
op stop timeout="60s" interval="0"
primitive ClusterIP ocf:heartbeat:IPaddr2
params ip="192.168.1.150" cidr_netmask="24"
op monitor interval="30s"
order ClusterIP-before-Apache inf: ClusterIP Apache:start
property $id="cib-bootstrap-options"
dc-version="1.1.10-1.el6_4.4-368c726"
cluster-infrastructure="classic openais (with plugin)"
expected-quorum-votes="2"
stonith-enabled="false"
last-lrm-refresh="1383902488"
In this example we configured the start and stop order of our ClusterIP and Apache resources. As configured, ClusterIP resource will start first and only then Apache resource can be started. When stopping, Apache resource will be stopped and only then ClusterIP resource can be stopped too.
Linux Cluster Resources Colocation “crm configure colocation colocationname inf: resource1 resource2“
We can configure Linux Cluster resources colocation. Like said we colocate the desired resources and make sure we always run desired resources on the same node at all time.
[root@node1 ~]# crm configure colocation IP-with-APACHE inf: ClusterIP Apache
[root@node1 ~]# crm configure show
node node2
node node2
primitive Apache ocf:heartbeat:apache
params configfile="/etc/httpd/conf/httpd.conf"
op monitor interval="30s"
op start timeout="40s" interval="0"
op stop timeout="60s" interval="0"
primitive ClusterIP ocf:heartbeat:IPaddr2
params ip="192.168.1.150" cidr_netmask="24"
op monitor interval="30s"
group HTTP-GROUP ClusterIP Apache
colocation IP-with-APACHE inf: ClusterIP Apache
order ClusterIP-before-Apache inf: ClusterIP Apache:start
property $id="cib-bootstrap-options"
dc-version="1.1.10-1.el6_4.4-368c726"
cluster-infrastructure="classic openais (with plugin)"
expected-quorum-votes="2"
stonith-enabled="false"
last-lrm-refresh="1384349363"
In this example, we configured colocation for ClusterIP and Apache resources. ClusterIP and Apache resources will always be started and running together, on the same Linux Cluster node.
Linux Cluster Resources Prefered Location “crm configure location locationname resource score: clusternode“
We can configure a prefered location for our Linux Cluster resources or resource groups. We must always set the location score – ositive values indicate the resource should run on this node. Negative values indicate the resource should not run on this node.
[root@node1 ~]# crm configure location HTTP-GROUP-prefer-NODE1 HTTP-GROUP 50: node1
[root@node1 ~]# crm configure show
node node1
node node2
primitive Apache ocf:heartbeat:apache
params configfile="/etc/httpd/conf/httpd.conf"
op monitor interval="30s"
op start timeout="40s" interval="0"
op stop timeout="60s" interval="0"
primitive ClusterIP ocf:heartbeat:IPaddr2
params ip="192.168.61.150" cidr_netmask="24"
op monitor interval="30s"
group HTTP-GROUP ClusterIP Apache
location HTTP-GROUP-prefer-NODE1 HTTP-GROUP 50: node1
colocation IP-with-APACHE inf: ClusterIP Apache
order ClusterIP-before-Apache inf: ClusterIP Apache:start
property $id="cib-bootstrap-options"
dc-version="1.1.10-1.el6_4.4-368c726"
cluster-infrastructure="classic openais (with plugin)"
expected-quorum-votes="2"
stonith-enabled="false"
last-lrm-refresh="1384349363"
In this example we configured the prefered location of HTTP-GROUP resource group. By configuring score 50, HTTP-GROUP will prefer to run on node1 node but will still in case of node1 failure move to node2. When node1 recovers, HTTP-GROUP will move back to prefered node1.
Checking the status of our Linux Cluster Nodes and Resources:
[root@node1 ~]# crm status
Last updated: Wed Nov 13 15:30:45 2013
Last change: Wed Nov 13 15:01:06 2013 via cibadmin on node1
Stack: classic openais (with plugin)
Current DC: node2 - partition with quorum
Version: 1.1.10-1.el6_4.4-368c726
2 Nodes configured, 2 expected votes
2 Resources configured
Online: [ node1 node2 ]
Resource Group: HTTP-GROUP
ClusterIP (ocf::heartbeat:IPaddr2): Started node1
Apache (ocf::heartbeat:apache): Started node1
Adding LSB Agents