Linux – the most effective way to setup a linux web server for manual failover

failoverlinuxUbuntu

I currently administer a small web server running ubuntu linux with apache, mysql, and ssh.
I'm backing it up using rsync to another server, but I'm backing it up to a /backup directory.

I'd like to have it set up where if the first server goes down I can change the ip of the second server and have all the users, files, databases etc. ready to go.

Does anyone have any suggestions on the easiest / best way to go about this?

Considerations

  • Users
  • Databases
  • Apache Configuration
  • Files
  • Making sure the same software is installed on both boxes. (probably need to do this up front)

Best Answer

For file based services (a web server etc.) rsync can effectively keep the second server up to date - (users, configs etc) - when it comes to databases things get a bit more complex (I've used MySQL and a slave server for this and it was very effective, I've also used PostgreSQL in a few HA/standby configurations but it was way more clumsy)

This, combined with a bit of IP theft (a quick script to assign the IP of the failed machine to the interface of the backup machine) can make for a relatively straighforward setup but allow quick recovery.

Just one thing to consider - beware of the failback. Moving services to a backup machine is one thing, moving them back once you've corrected the failure can get hairy, pay close attention to the databases.

LinuxHA is a (somewhat heavyweight) approach to this if you decide to make it a bit more automated

http://www.linux-ha.org/