I would like to understand if my below scenarios are possible in Heartbeat in Linux.

Setup: Two Database Servers running Mysql in Active/Passive mode in replication mode having Heartbeat setup for HA or failover mechanism. Application connects to DB using VIP that is started at the time of Heartbeat.

  • Failover VIP to passive site if primary Mysql intance is shut down.
  • Bring down the heartbeat in primary if the role has been given to passive/secondary site inorder to avoid split brain.
  • I believe that you need maybe more than just VRRP (Virtual redundant Routing protocol) since DB is involved, This makes me then think that question is more suited to dba.stackexchange.com, than just pure Unix/linux. Here's a questions that appears to be very closely related. Also probably depends on which engine is used (INNODB, etc). Since failback and recovery should be considered as well. – X Tian Mar 5 '14 at 15:24
  • Yes I was thinking this Q is probably more suited to either DBA or ServerFault. – slm Mar 5 '14 at 15:46
  • @X Tian: heartbeat normally don't need VRRP it switches the IP's with ifconfig. – user55518 Mar 5 '14 at 22:32
  • @mannoj: In your case I'd not use heartbeat, but mysql-ndb. You'll get then an active/active HA with 2 IP's and a DNS name points to 2 ips so the load balancing is done by a DNS client. – user55518 Mar 5 '14 at 22:34
  • Pls follow the discussion on dba.stackexchange.com/questions/60216/… – mannoj Mar 6 '14 at 10:36

Unless I'm misunderstanding something, this is a very common scenario, and well supported in linux.

Currently the best tool for the job is Pacemaker. Pacemaker sits on top of Corosync and runs on all the nodes in the cluster. It sends heartbeat messages around, and when it detects that a node has failed, it migrates all resources off that node, and can optionally kill the node (referred to as fencing).

Resources are things like a VIP, or a MySQL database. Some resources support master/slave modes, in which if the node running the master fails, pacemaker will promote the slave to master.

Resources are driven through scripts, so if it can be scripted, pacemaker can support it. There are a large number of resources already created, so you likely do not need to do this.

It also supports ordering so that when resources are moved around, it can do things like make sure that MySQL has been promoted to master before moving the VIP so that no clients connect to it before it's ready.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.