How to control a service from Linux pacemaker cluster

high-availabilitypacemakerrhel7

I have set a two node cluster on two RHEL7 virtual machines. I'm using pacemaker as my HA management software. I creates one resource for VIP and another resource for a shared FS. VIP and FS resources are working properly. However, I don't know how to let a specific service to failover like VIP and FS. I searched a lot but I can't find a way to do it. I have a script with three options to start,stop and get the status of my service. Now, I just want to add the service to my cluster, so if it went down on one node, it comes up on the other node. What I should use for that?

Best Answer

There are a few ways to do this.

The best way, is to write your own OCF (Open Cluster Framework) resource agent as described in the OCF Resource Agent Developer’s Guide: http://www.linux-ha.org/doc/dev-guides/ra-dev-guide.html

You could also write a systemd unit file that starts your service, and then tell the cluster to control the service using that: # pcs resource create whatever systemd:<systemd-unit-name>

Lastly, there is an anything resource agent that you can use to launch Linux daemons. It seems like RedHat and CentOS do not provide this resource-agent in their latest resource-agents package (version 4.1.1). However, you can get it from ClusterLab's GitHub here: https://raw.githubusercontent.com/ClusterLabs/resource-agents/master/heartbeat/anything

One of those three should work for you. However, I would recommend taking the time to create a proper OCF resource agent for your service as described in the OCF RA Developer Guide linked above.

Related Topic