0

I use Pacemaker+Corosync to handle my cluster. DRBD+FileSystem+IPADDR resources configured sucessfully and running propertly.

my purpose now it to execute my own script (actually to start oracle service) when failover is happening.

As I saw in few places I took the "Dummy" resource agent copy it and modify this file to run my script inside the start function.

I create my resource with the new resource agent and it's was created successfully and also have "started" state.

Now the problem is that when resource started my script isn't running (ofcourse also on failover and switchover it's not running).

I tried to run the resource command "pcs resource restart" for forcing running the script but it's still not running.

BUT when I use the command "resource debug-start resource-name" my script is RUNNING.

Here is my configuration and statuses of running the commands: Inside the copy of the resource agent where I put my script - /usr/lib/ocf/resource.d/heartbeat/StartOracle :

*startoracle_start() {
    startoracle_monitor
    if [ $? =  $OCF_SUCCESS ]; then
        /opt/startOracle.sh
        return $OCF_SUCCESS
    fi
    touch ${OCF_RESKEY_state}
}*

my clust_cfg file is:

**pcs status:**
*Cluster name: opt_cluster
Stack: corosync
Current DC: pcmk01-cr (version 1.1.15-11.el7_3.2-e174ec8) - partition with quorum
Last updated: Tue Jan 17 14:31:16 2017          Last change: Tue Jan 17 14:22:40 2017 by root via cibadmin on pcmk01-cr
2 nodes and 5 resources configured
Online: [ pcmk01-cr pcmk02-cr ]
Full list of resources:
 Master/Slave Set: myoptClone01 [myopt_data01]
     Masters: [ pcmk01-cr ]
     Slaves: [ pcmk02-cr ]
 myopt_fs01     (ocf::heartbeat:Filesystem):    Started pcmk01-cr
 myopt_VIP01    (ocf::heartbeat:IPaddr2):       Started pcmk01-cr
 StartOracleResource    (ocf::heartbeat:StartOracle):   Started pcmk01-cr
Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled*

    [root@pcmk01]# **pcs resource restart StartOracleResource**
    *StartOracleResource successfully restarted*

    [root@pcmk01]# **pcs resource debug-start StartOracleResource**
    *Operation start for StartOracleResource (ocf:heartbeat:StartOracle) returned 0
     >  stdout: The Oracle base remains unchanged with value /opt/oracle
     >  stdout: The Oracle base remains unchanged with value /opt/oracle
     >  stdout: Processing Database instance "mng164": log file /opt/o
 oracle/ora11/shutdown.log
 >  stdout: The Oracle base remains unchanged with value /opt/oracle
 >  stdout: The Oracle base remains unchanged with value /opt/oracle
 >  stdout: Processing Database instance "mng164": log file       /opt/oracle/ora11/startup.log
 >  stderr: DEBUG: StartOracleResource start : 0*
Lidor Aviman
  • 91
  • 1
  • 4
  • 14
  • Are you sure you're getting into that point of the function? What does startoracle_monitor return? – Matt Kereczman Jan 20 '17 at 22:28
  • I didn't touch the monitor function. – Lidor Aviman Jan 22 '17 at 06:50
  • When I use "pcs resource debug-start" I'm getting into that point of function but when the resource stated by him self it's not getting into my own custom function. – Lidor Aviman Jan 22 '17 at 07:48
  • Perhaps your script is throwing some error that you're not catching. It looks like you're not checking the return code from your script, and just declaring to Pacemaker it was successful no matter what. – Matt Kereczman Jan 23 '17 at 16:30
  • Without everything (complete cib, complete script, complete custom resource agent, etc) there is too much guess work involved in assisting. Provide more information and maybe you'll have better luck getting an answer. – Matt Kereczman Jan 23 '17 at 16:32

0 Answers0