By using MySQL Master/Master replication and Heartbeat from the Linux Virtual Server project, a high availability database solution can be achieved.
Two MySQL servers have been configured as a standard Master/Master solution. The same servers are running the Heartbeat software with both monitoring each other.
The Active MySQL Master hosts the Virtual IP (192.168.0.100). All MySQL traffic from the web nodes is directed to the Active MySQL Master. Read only requests (reports and backups) will be run from the Passive MySQL Master.
When the Active MySQL Master server crashes, Heartbeat will detect the failure and bring up the Virtual IP on the Passive server. All MySQL traffic from the web nodes is now directed to the Secondary MySQL Master hosting the 192.168.0.100 Virtual IP address. This is now Active
When the 192.168.0.1 comes back online, Heartbeat will detect this BUT will keep the Virtual IP 192,168,0,100 on the current Active Master. Once the original Master has caught up, a manual switch back will be performed.