Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I currently have a VPS hosted in Charleston, NC. My current provider is offering a deal to purchase an identical (resource wise) VPS in another data center. Although I rarely experience downtime, I would like to purchase the other VPS and set it up as a hot spare to take over automatically in case of a failure of the VPS in Charleston.

My server runs provides my clients with a web server (apache), a database (mysql), a mail server (postfix + courier), and DNS (bind9). The OS is Ubuntu Server 11.04

How can I setup the additional server to it automatically functions as a failover, and how can I keep everything in sync.

share|improve this question

2 Answers 2

Well, there are literally very many tools for migrating the configurations over. However automatic fail-over and maintaining live replicated data are a hard thing to achieve.

For the former requirement, ie configs, If I don't have a configuration tool such as chef (which would seem inappropriate in your case) I just install webmin on both nodes, and backup the configurations using the tools.

webmin has a cluster manager which is useful, but rsync, cron or various system imaging tools are available.

The hard part for a "hot" backup is the data in mysql and any user data in postfix, and whether you actually want to hot replicate that.

if you really need a hot failover...

I would look into mysql replication, to maintain the database you might look at monit, heartbeat or stonith tools to handle automatic failover. also the MMM tool is popular, but my experience with it is mixed.

share|improve this answer
    
I currently use Webmin and VirtualMin to manage my apache server and server in general. Everything (unless I'm doing load balancing) doesn't need to be synced. I.E., if the server goes down, it's okay if the hot space has day old data instead of second old data. –  Malfist Mar 14 '12 at 13:09
    
its sounds like a possible solution is to use the 2nd VPS as a backup target, so you have local data to restore. If you share a ssh key between the 2 hosts, you can use rsync to keep a backup directory in sync between to 2 hosts. –  Tom H Mar 14 '12 at 13:33
    
haha, I think your terminology is likely setting a requirement, that the details of your question indicate is not actually a "must have". A hot spare generally indicates an operational and functional 2nd system that can takeover production services either automatically, or in some appropriately simple fashion. This would generally imply replicated system data, and automated monitoring and failover. However i think what you are talking about is closer to "warm spare" –  Tom H Mar 14 '12 at 14:09
    
webopedia.com/TERM/W/warm_standby.html I basically just build the second box with the same config as the first, and use it to stage your mysqldump and tar/rsync user system backups, then you can manually intervene to bring the alternative system up on disaster –  Tom H Mar 14 '12 at 14:12

Since your two servers are going to be in different datacenters, you will need to rely on changing DNS entries to point to the new servers.

Many clustering and failover systems rely on having a virtual IP - one that either system can take over by sending out arp broadcasts to tell the switch to start sending the traffic to them.

In seperate datacenters, you can't have one IP that can be routed to both servers.

share|improve this answer
    
DNS can take over an hour to propagate though... –  Malfist Mar 14 '12 at 13:31
    
Which is why you'd want to use a really low TTL in your DNS records. 60 seconds should suffice. The only want to get instant failover is by having them in the same datacenter on the same LAN. Or to add a third device like a load balancer as the main IP your site uses to switch between servers. Neither option helps with datacenter level failures. –  Grant Mar 14 '12 at 13:38
    
Wouldn't adding a third device (the load balancer) introduce another single point of failure? –  Malfist Mar 14 '12 at 13:40
    
@Malfist it absolutely would. So in this case DNS failover is probably the most reliable solution –  Grant Mar 14 '12 at 17:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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