In our previous tutorial, we have shown you how to install corosync and pacemaker.
We will show you now how to add resources.
Before starting the configurations, pleaseĀ disable STONITH (Shoot The Other Node In The Head) with CRM command:
crm configure property stonith-enabled=false
check if stonith diabled:
[root@node1 ~]# crm configure show node node1 node node2 property $id="cib-bootstrap-options" dc..-version="1.1.10-14el6_52-368c726" cluster-infrastructure="classic openais (with plugin)" expected-quorum-votes="2" stonith-enabled="false"
Add Cluster Resources
The cluster resource is defined by a Resource Agent and most know cluster agent classes are:
LSB (Linux Standard Base) ā These are common cluster resource agents found in /etc/init.d directory (init scripts).
Example:
[root@node1 ~]# crm ra list lsb NetworkManagerĀ Ā Ā abrt-ccppĀ Ā Ā Ā Ā Ā Ā Ā abrt-oopsĀ Ā Ā Ā Ā Ā Ā Ā abrtdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā acpidĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā atdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā auditdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā autofs blk-availabilityĀ bluetoothĀ Ā Ā Ā Ā Ā Ā Ā certmongerĀ Ā Ā Ā Ā Ā Ā cntlmdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā corosyncĀ Ā Ā Ā Ā Ā Ā Ā Ā corosync-notifydĀ cpuspeedĀ Ā Ā Ā Ā Ā Ā Ā Ā cups dnsmasqĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā firstbootĀ Ā Ā Ā Ā Ā Ā Ā haldaemonĀ Ā Ā Ā Ā Ā Ā Ā haltĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā htcachecleanĀ Ā Ā Ā Ā httpdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ip6tablesĀ Ā Ā Ā Ā Ā Ā Ā iptables irqbalanceĀ Ā Ā Ā Ā Ā Ā kdumpĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā killallĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā lvm2-lvmetadĀ Ā Ā Ā Ā lvm2-monitorĀ Ā Ā Ā Ā mdmonitorĀ Ā Ā Ā Ā Ā Ā Ā messagebusĀ Ā Ā Ā Ā Ā Ā netconsole netfsĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā networkĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā nfsĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā nfslockĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā ntpdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ntpdateĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā oddjobdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā pacemaker pacemaker_remoteĀ portreserveĀ Ā Ā Ā Ā Ā psacctĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā quota_nldĀ Ā Ā Ā Ā Ā Ā Ā rdiscĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā restorecondĀ Ā Ā Ā Ā Ā rngdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā rpcbind rpcgssdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā rpcidmapdĀ Ā Ā Ā Ā Ā Ā Ā rpcsvcgssdĀ Ā Ā Ā Ā Ā Ā rsyslogĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā sandboxĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā saslauthdĀ Ā Ā Ā Ā Ā Ā Ā singleĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā smartd snmpdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā snmptrapdĀ Ā Ā Ā Ā Ā Ā Ā spawn-fcgiĀ Ā Ā Ā Ā Ā Ā spice-vdagentdĀ Ā Ā sshdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā sssdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā udev-postĀ Ā Ā Ā Ā Ā Ā Ā wdaemon winbindĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā wpa_supplicantĀ Ā Ā ypbind [root@node1 ~]#
OCF (Open Cluster Framework) ā These are actually extended LSB cluster resource agents and usually support additional parameters
example:
[root@node1 ~]# crm ra list ocf ASEHAagent.shĀ Ā Ā Ā Ā Ā AoEtargetĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā AudibleAlarmĀ Ā Ā Ā Ā Ā Ā CTDBĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ClusterMonĀ Ā Ā Ā Ā Ā Ā Ā Ā DelayĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Dummy EvmsSCCĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā EvmsdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā FilesystemĀ Ā Ā Ā Ā Ā Ā Ā Ā HealthCPUĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā HealthSMARTĀ Ā Ā Ā Ā Ā Ā Ā ICPĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā IPaddr IPaddr2Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā IPsrcaddrĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā IPv6addrĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā LVMĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā LinuxSCSIĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā MailToĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ManageRAID ManageVEĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Pure-FTPdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Raid1Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā RouteĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā SAPDatabaseĀ Ā Ā Ā Ā Ā Ā Ā SAPInstanceĀ Ā Ā Ā Ā Ā Ā Ā SendArp ServeRAIDĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā SphinxSearchDaemonĀ SquidĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā StatefulĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā SysInfoĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā SystemHealthĀ Ā Ā Ā Ā Ā Ā VIPArip VirtualDomainĀ Ā Ā Ā Ā Ā WASĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā WAS6Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā WinPopupĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā XenĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā XinetdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā anything apacheĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā apache.shĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā asteriskĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā clusterfs.shĀ Ā Ā Ā Ā Ā Ā conntrackdĀ Ā Ā Ā Ā Ā Ā Ā Ā controldĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā db2 dhcpdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā drbdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā drbd.shĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā eDir88Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ethmonitorĀ Ā Ā Ā Ā Ā Ā Ā Ā exportfsĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā fio fs.shĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā iSCSILogicalUnitĀ Ā Ā iSCSITargetĀ Ā Ā Ā Ā Ā Ā Ā idsĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ip.shĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā iscsiĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā jboss ldirectordĀ Ā Ā Ā Ā Ā Ā Ā Ā lvm.shĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā lvm_by_lv.shĀ Ā Ā Ā Ā Ā Ā lvm_by_vg.shĀ Ā Ā Ā Ā Ā Ā lxcĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā mysqlĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā mysql-proxy mysql.shĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā namedĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā named.shĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā netfs.shĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā nfsclient.shĀ Ā Ā Ā Ā Ā Ā nfsexport.shĀ Ā Ā Ā Ā Ā Ā nfsserver nfsserver.shĀ Ā Ā Ā Ā Ā Ā nginxĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ocf-shellfuncsĀ Ā Ā Ā Ā openldap.shĀ Ā Ā Ā Ā Ā Ā Ā oracleĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā oracledb.shĀ Ā Ā Ā Ā Ā Ā Ā orainstance.sh oralistener.shĀ Ā Ā Ā Ā oralsnrĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā pgsqlĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā pingĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā pingdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā portblockĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā postfix postgres-8.shĀ Ā Ā Ā Ā Ā poundĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā proftpdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā remoteĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā rsyncdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā rsyslogĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā samba.sh script.shĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā scsi2reservationĀ Ā Ā service.shĀ Ā Ā Ā Ā Ā Ā Ā Ā sfexĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā slapdĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā smb.shĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā svclib_nfslock symlinkĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā syslog-ngĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā tomcatĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā tomcat-5.shĀ Ā Ā Ā Ā Ā Ā Ā tomcat-6.shĀ Ā Ā Ā Ā Ā Ā Ā varnishĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā vm.sh vmwareĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā zabbixserver [root@node1 ~]#
Cluster Resource Name: Cluster_Server
Resource Agent: ocf:heartbeat:IPaddr2 (get this info with ācrm ra meta IPaddr2ā³)
IP address: 192.168.1.200
Netmask: 24
Monitor interval: 30 seconds (get this info with ācrm ra meta IPaddr2ā³)
Run the command in one of the nodes:
crm configure primitiveĀ Cluster_ServerĀ ocf:heartbeat:IPaddr2 params ip=192.168.1.200 cidr_netmask="24" op monitor interval="30s"
Ā Check Cluster Configuration:
[root@node1 ~]# crm configure show node node1 node node2 primitive Cluster_Server ocf::heartbeatIPaddr2 Ā Ā Ā Ā Ā Ā Ā params ip="192.168.1.200" cidr_netmask="24" Ā Ā Ā Ā Ā Ā Ā op monitor interval="30s" property $id="cib-bootstrap-options" Ā Ā Ā Ā Ā Ā Ā dc..-version="1.1.10-14el6_52-368c726" Ā Ā Ā Ā Ā Ā Ā cluster-infrastructure="classic openais (with plugin)" Ā Ā Ā Ā Ā Ā Ā expected-quorum-votes="2" Ā Ā Ā Ā Ā Ā Ā stonith-enabled="false" Ā Ā Ā Ā Ā Ā Ā no-quorum-policy="ignore" [root@node1 ~]#
Ā ClusterĀ Status:
[root@node1 ~]# crm status Last updated: Thu MarĀ 6 11:20:52 2014 Last change: Thu MarĀ 6 09:57:49 2014 via cibadmin on node1 Stack: classic openais (with plugin) Current DC: node2 - partition with quorum Version: 1.1.10-14.el6_5.2-368c726 2 Nodes configured, 2 expected votes 1 Resources configured Online: [ node1 node2 ] Ā Cluster_Server (ocf::heartbeat:IPaddr2):Ā Ā Ā Ā Ā Ā Started node2
Ā Add Apache (httpd) Resource:
crm configure primitive Apache ocf:heartbeat:apache params configfile=/etc/httpd/conf/httpd.conf op monitor interval=1min
If you have any warning like this:
WARNING: Apache: default timeout 20s for start is smaller than the advised 40s WARNING: Apache: default timeout 20s for stop is smaller than the advised 60s
fix it with:
crm configure property default-action-timeout="240"
Check:
[root@node1 ~]# crmĀ status Last updated: Thu MarĀ 6 11:39:44 2014 Last change: Thu MarĀ 6 11:39:36 2014 via cibadmin on node1 Stack: classic openais (with plugin) Current DC: node2 - partition with quorum Version: 1.1.10-14.el6_5.2-368c726 2 Nodes configured, 2 expected votes 2 Resources configured Online: [ node1 node2 ] Ā Cluster_Server (ocf::heartbeat:IPaddr2):Ā Ā Ā Ā Ā Ā Started node2 Ā Apache (ocf::heartbeat:apache):Ā Ā Ā Ā Ā Ā Ā Started node1 [root@node1 ~]#
That meansĀ (http://192.168.1.200) should be live even if node1 or node down.
Deleting Apache (httpd) Resource
Ā crm resource stop Apache Ā crm configure delete Apache
Deleting IP Address Resource
crm resource stop Cluster_Server crm configure delete Cluster_Server