Pacemaker - Resource (dummy) not execute my script on failover

2.8k Views Asked by At

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*
0

There are 0 best solutions below