0

I have a 2 node cluster on RHEL 6.9. Everything is configured except I'm having difficulty with an application launched via shell script that created into a service (in /etc/init.d/myApplication), which I'll just call "myApp". From that application, I did a pcs resource create myApp lsb:myApp op monitor interval=30s op start on-fail=standby. I am new to using this suite of software but it's for work. What I need is for this application to be launched on both nodes simultaneously as it has to be started manually so if the first node fails, it would need intervention if it were not already active on the passive node.

I have two other services:
-VirtIP (ocf:heartbeat:IPaddr2) for providing a service IP for the application server
-Cron (lsb:crond) to synchronize the application files (we are not using shared storage)

I have the VirtIP and Cron as dependents via colocation to myApp.

I've tried master/slave as well as cloning but I must be missing something regarding their config. If I take the application offline, pacemaker does not detect the service has gone down and pcs status outputs that myApp is still running on the node (or nodes depending on my config). I'm also sometimes getting the issue that the service running the app is stopped by pacemaker on the passive node.

Which is the way I need to configure this? I've gone through the RHEL documentation but I'm still stuck. How do I get pacemaker to initiate failover if myApp service goes down? I don't know why it's not detecting the service has stopped in some cases.

EDIT: So for testing purposes, I removed the password requirement for starting/restarting and the service starts/restarts fine as expected and the colocation dependent resources stop/start as expected. But stopping the myApp service does not reflect as a stopped resource but simply stays at Started node1. Likewise, simulating a failover via putting node1 into standby simply stops all resources on node1.

  • If you want the app to run on both servers, why use pcs? pcs is good for running X instances of software on Y nodes, where X < Y. Sounds like you're trying to run the application on all the nodes, so why use pcs for it? Just start them as a service on startup. – Centimane Sep 29 '17 at 15:39
  • Also, it sounds like pacemaker is acting as expected with regards to stopping on the passive node. By default pcs assumes only one instance of a resource should run in the cluster. If it sees a rogue instance on another node it should shut it down. – Centimane Sep 29 '17 at 16:14
  • I thought either cloning or master/slave (or both) configurations were meant to support multi-state resources. So to clarify, I have 3 resources total. A "Cron" for syncing files using rsync, a "VirtIP" to provide the service IP address, and my "myApp". The Cron and VirtIP do not need to run constantly, only on the active node and I'm have no issues getting them to work. The MyApp however, which requires a password to start, ideally needs to run constantly so that if node1 (active) fails, when it fails over to node2, there will be no downtime between failure and the sysadmin putting in a PW. – Greg Oct 2 '17 at 12:33
  • However, I might be able to circumvent a password requirement. So for testing purposes, I did that and the service starts/restarts fine as expected and the colocation dependent resources stop/start as expected. But stopping the myApp service does not reflect as a stopped resource but simply stays at Started node1. Likewise, simulating a failover via putting node1 into standby simply stops all resources on node1. – Greg Oct 2 '17 at 12:38
2

My guess would be that your shell/init script is not returning the proper return codes. In order for pacemaker to play nicely with an init script that init script needs to be fully LSB compliant. Run the init script though the compatibility checks here: http://www.linux-ha.org/wiki/LSB_Resource_Agents

I suspect your script is returning a 0 on the status when it should not be.

  • rather than guessing, you should ask the OP for more information, such as the init script, or the result of some commands (e.g. running the init script and running echo $?) – Centimane Sep 29 '17 at 15:11
  • I have checked that for all 6 conditions (from stopped state: start | status | stop, from stopped: start | status | stop) and each return a code of 0. You said it should not? That wiki page says "If the answer to any of the above questions is no, then the init script is not LSB compliant." so I assume by returning a 0, means it is compliant. This service was created by a contractor. I did however inspect the init script and everything seems to to be okay. – Greg Oct 2 '17 at 12:28
  • 1
    Test number 5 should return a 3 not a 0. Thus the init script is not LSB compliant and will not behave as expected when used with pacemaker. – Dok Oct 2 '17 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.