Server Fault Asked by Alessandro Cardoso on January 17, 2021
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?
There are quite a few different ways you might achieve that.
You could put a script in /etc/init.d/
but you'll need to make sure it's LSB compliant: http://www.linux-ha.org/wiki/LSB_Resource_Agents
You could write an OCF resource agent for Pacemaker: http://www.linux-ha.org/doc/dev-guides/ra-dev-guide.html
Or you could try using the ocf:heartbeat:anything resource agent. It can run an arbitrary command, but there is setup/requirements involved with it. Run the following command on one of you nodes to learn more: # crm ra info ocf:heartbeat:anything
Answered by Matt Kereczman on January 17, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP