4

I set up a high availability system with Heartbeat, I wish that when there was a drop in the main cluster and the secondary cluster was activated, Heartbeat start in it and execute a shell script.

  • Contents of /etc/ha.d/haresources

    master IPaddr::10.0.0.1/24 test.sh
    
  • Contents of /etc/ha.d/ha.cf

    autojoin none
    debugfile /var/log/ha-debug
    logfile /var/log/ha-log
    logfacility local0
    ucast ens32 10.0.0.3 
    ucast ens32 10.0.0.2
    udpport 694 
    use_logd yes
    keepalive 1
    deadtime 10
    warntime 5
    initdead 20
    node master
    node slave
    auto_failback on
    

I gave execute permission to the script and put it in the path /etc/init.d/, but I still could not get it executed through Heartbeat, is this type of procedure possible?

Vlastimil Ovčáčík
  • 2,748
  • 1
  • 24
  • 32
  • 1
    Could you add your `/etc/ha.d/ha.cnf` ? – Alex Aug 21 '18 at 18:03
  • This sounds more like a job for *cluster resource manager* instead of Heartbeat. And indeed I was able to find this article describing a solution: [Pacemaker - Execute script on failover](https://raymii.org/s/tutorials/Corosync_Pacemaker_-_Execute_a_script_on_failover.html). If it solves your problem you could later answer your own question with details on how you did it. – Vlastimil Ovčáčík Aug 21 '18 at 18:34
  • If you would execute `hostname` command, does it returns "master"? – Alex Aug 21 '18 at 18:52
  • @VlastimilOvčáčík i will check this option, thanks – Alessandro Cardoso Aug 21 '18 at 19:07
  • @Alex yes, I configured the clusters this way because I'm configuring in test environment. – Alessandro Cardoso Aug 21 '18 at 19:11

0 Answers0