Resource agents plays an important role in cluster management. Resource agents are multi-threaded processes that provides the logic to manage the resources. Pacemaker has one agent per resource type. Resource type could be a File-system , IP address , databases, virtual-domain and more. Resource agent is responsible to monitor, start , stop,validate , migrate , promote and demote the cluster resources whenever required. Most of the resource agents are compliant to Open Cluster Framework (OCF) . Let’s add one IP resource to the existing cluster and then we will get in to the detailed explanation of command options.
1. Login to one of the Redhat Cluster (Pacemaker/corosync) cluster node as root user.
2. Check the cluster status .
[root@UA-HA ~]# pcs status Cluster name: UABLR Last updated: Mon Dec 28 13:06:01 2015 Last change: Sun Dec 27 23:59:59 2015 by root via cibadmin on UA-HA Stack: corosync Current DC: UA-HA (version 1.1.13-10.el7-44eb2dd) - partition with quorum 2 nodes and 0 resources configured Online: [ UA-HA UA-HA2 ] Full list of resources: PCSD Status: UA-HA: Online UA-HA2: Online Daemon Status: corosync: active/enabled pacemaker: active/enabled pcsd: active/enabled [root@UA-HA ~]#
3. Add the IP which needs to be high-available (Clustered IP).
[root@UA-HA ~]# pcs resource create ClusterIP ocf:heartbeat:IPaddr2 ip=192.168.203.190 cidr_netmask=24 op monitor interval=30s [root@UA-HA ~]#
ClusterIP – Resource Name(You can give any name)
ocf:heartbeat:IPaddr2 – Resource agent Name.
Resource Standard:
The first field (ocf in this case) is the standard to which the resource script conforms and where to find it.
To obtain a list of the available resource standards , use the following command.
[root@UA-HA ~]# pcs resource standards ocf - Open cluster Framework lsb - Linux standard base (legacy init scripts) service - Based on Linux "service" command. systemd - systemd based service Management stonith - Fencing Resource standard. [root@UA-HA ~]#
Resource Provides:
The second field (heartbeat in this case) is standard-specific; for OCF resources, it tells the cluster which OCF namespace the resource script is in. To obtain a list of the available OCF resource providers, use the following command.
[root@UA-HA ~]# pcs resource providers heartbeat openstack pacemaker [root@UA-HA ~]#
What are the pre-built resource agents available in RHEL 7.2 ?
The third field (IPaddr2 in this case) is the name of the resource script. To see all the resource agents available for a specific OCF provider (heartbeat) , use the following command.
[root@UA-HA ~]# pcs resource agents ocf:heartbeat CTDB Delay Dummy Filesystem IPaddr IPaddr2 IPsrcaddr LVM MailTo Route SendArp Squid VirtualDomain Xinetd apache clvm conntrackd db2 dhcpd docker ethmonitor exportfs galera iSCSILogicalUnit iSCSITarget iface-vlan mysql named nfsnotify nfsserver nginx oracle oralsnr pgsql postfix rabbitmq-cluster redis rsyncd slapd symlink tomcat [root@UA-HA ~]# pcs resource agents ocf:heartbeat |wc -l 41 [root@UA-HA ~]#
For Openstack , you have following resources agents.
[root@UA-HA ~]# pcs resource agents ocf:openstack NovaCompute NovaEvacuate [root@UA-HA ~]#
Here is the list resource agents to manager the pacemaker components.
[root@UA-HA ~]# pcs resource agents ocf:pacemaker ClusterMon Dummy HealthCPU HealthSMART Stateful SysInfo SystemHealth controld ping pingd remote [root@UA-HA ~]#
4.Verify the resource status.
[root@UA-HA ~]# pcs status Cluster name: UABLR Last updated: Mon Dec 28 13:07:33 2015 Last change: Mon Dec 28 13:07:30 2015 by root via cibadmin on UA-HA Stack: corosync Current DC: UA-HA (version 1.1.13-10.el7-44eb2dd) - partition with quorum 2 nodes and 1 resource configured Online: [ UA-HA UA-HA2 ] Full list of resources: ClusterIP (ocf::heartbeat:IPaddr2): Started UA-HA PCSD Status: UA-HA: Online UA-HA2: Online Daemon Status: corosync: active/enabled pacemaker: active/enabled pcsd: active/enabled
As per the cluster status , IP resource is online on node “UA-HA” . Let’s verify from OS command line.
[root@UA-HA ~]# ip a |grep inet inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host inet 192.168.203.134/24 brd 192.168.203.255 scope global dynamic br0 inet 192.168.203.190/24 brd 192.168.203.255 scope global secondary br0 inet6 fe80::84ef:2eff:fee9:260a/64 scope link inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 [root@UA-HA ~]# [root@UA-HA ~]# ping 192.168.203.190 PING 192.168.203.190 (192.168.203.190) 56(84) bytes of data. 64 bytes from 192.168.203.190: icmp_seq=1 ttl=64 time=0.084 ms 64 bytes from 192.168.203.190: icmp_seq=2 ttl=64 time=0.090 ms 64 bytes from 192.168.203.190: icmp_seq=3 ttl=64 time=0.121 ms 64 bytes from 192.168.203.190: icmp_seq=4 ttl=64 time=0.094 ms ^C --- 192.168.203.190 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3006ms rtt min/avg/max/mdev = 0.084/0.097/0.121/0.015 ms [root@UA-HA ~]#
We can see that IP “192.168.203.190/24” is up & running. This IP will automatically move from one node to another node if the system fails.
Gaurav says
i am getting following error after i initiated step 3 from above
Cluster name: MBBLK
Stack: corosync
Current DC: –hostname– (version 1.1.16-12.el7-94ff4df) – partition with quorum
Last updated: Mon Dec 31 17:08:14 2018
Last change: Mon Dec 31 17:02:51 2018 by root via cibadmin on cdac.msdg.server10
2 nodes configured
1 resource configured
Online: [ –hostname– –hostname– ]
Full list of resources:
ClusterIP (ocf::heartbeat:IPaddr2): Stopped
Failed Actions:
* ClusterIP_start_0 on –hostname– ‘unknown error’ (1): call=6, status=complete, exitreason=’Unable to find nic or netmask.’,
last-rc-change=’Mon Dec 31 17:02:51 2018′, queued=0ms, exec=41ms
* ClusterIP_start_0 on –hostname– ‘unknown error’ (1): call=6, status=complete, exitreason=’Unable to find nic or netmask.’,
last-rc-change=’Mon Dec 31 17:02:37 2018′, queued=0ms, exec=43ms