Linux – Stop heartbeat from failing over on failures

centosheartbeatlinux

I have 2 CentOS machines with Heartbeat. If node01 has a problem or reboots, node02 takes over — this works.

After node01 comes back up, node01 is no longer my primary which is great (node02 has taken over). But when I reboot node02, node01 becomes the primary again.

I don't want node01 to become primary again. I want to wait for node02 to come up as the primary. How can I achieve this?

Best Answer

If you want to avoid a "ping-pong" situation or want to check the system before it is ready to take over services again, I would recommend to

  • Start heartbeat manually after system boot chkconfig heartbeat off
  • Stop heartbeat after failover on the failed node.

The latter is a little bit tricky - but you could define a resource in your mysql-resource-group that stops heartbeat (but I would not recommend that - since you are shooting at your own feet that way).

This might be better outside heartbeat-control (perhaps a script that checks if cl_status rscstatus returns none and then stops heartbeat.