# VPS failover?



## Minmeo (Apr 22, 2014)

Hi there,

I want to make it so that if one of my VPSes goes offline from one provider that another VPS from a different provider will produce the data for my website. I know it is possible but unsure if I can set it up. What do I need?


----------



## datarealm (Apr 22, 2014)

The simplest method would be to accomplish this through DNS, though you have some caching issues with this approach.

Another way would be to use a load balancer to decide where to send the traffic.  LVS (www.linuxvirtualserver.org) works admirably for this task.  Of course now all of your services rely upon the availability of your load balancer...  If that fails then traffic will not be routed.  You can get around this with 2 load balancers in active/passive state, the next BUT being that you still have to decide where to locate the load balancers...  (Total datacenter failure again takes out the load balancers)


----------



## howardsl2 (Apr 23, 2014)

You need cloudflare, and a third server with the program "monit" to monitor the two servers. See details here:

http://blog.booru.org/?p=12


----------



## HalfEatenPie (Apr 23, 2014)

I'd say Rage4 DNS does this perfectly.


----------



## datarealm (Apr 23, 2014)

Again, while DNS failover is the simplest approach, you cannot overcome caching issues.


----------



## Minmeo (Apr 23, 2014)

Thanks. I will setup some text VPS servers and try something out before going live. Does anyone have any more suggestions?


----------



## mhosts (Apr 24, 2014)

datarealm said:


> Again, while DNS failover is the simplest approach, you cannot overcome caching issues.


You can set the TTL time for your records to a much lower amount. 300 or 500 seconds. If 5-8 minutes is to big of a window to be down, then your only option is to see if you can find a provider that is present in multiple different locations and that will assign anycast IP's to those VPS'.

Even that has the potential to have some down-time though (Ex: If the provider continues to advertise the prefix at that location because just your VPS out of many sharing that same network segment is down).

The only way to be absolutely 100% certain of no downtime is to advertise your own prefix via BGP from the VPS itself. That way if it goes down, it will automatically withdraw the route. That's the only way you can take DNS caching out of the equation. 

You could use a load balancer, but that brings in another single point of failure which defeats the purpose...


----------



## rupe (May 9, 2014)

How about using Rage4 DNS failover with two load balancing servers? Or would that be overkill


----------



## tdc-adm (May 9, 2014)

HalfEatenPie said:


> I'd say Rage4 DNS does this perfectly.


Please tell more details


----------



## HalfEatenPie (May 10, 2014)

tdc-adm said:


> Please tell more details


http://gbshouse.uservoice.com/knowledgebase/articles/336539-rage4-dns-how-to-failover

Basically it's a DNS Fail-over.  If your main site/VPS doesn't respond the DNS system automatically switches to a second IP until the first one comes back.


----------



## [email protected] (May 10, 2014)

Problem with DNS failover is caching as mentioned above. Some ISP simply ignore TTL values for DNS cache. Or users use their own setups. So your TTL might be a minute in your setup but at the other end failed IP might not update for another two hours.


----------



## raindog308 (May 10, 2014)

[email protected] said:


> Problem with DNS failover is caching as mentioned above. Some ISP simply ignore TTL values for DNS cache. Or users use their own setups. So your TTL might be a minute in your setup but at the other end failed IP might not update for another two hours.


So for years I told people this - that many DNS servers won't honor a TTL less than 1 hour.  And that round robin DNS wasn't the answer because the client could go back to the same failed IP.

However, I'm told that recent web browsers have round robin DNS "smarts":

- let's say they look up FantasticVPSOffers.com and get a RRDNS record that has 3 IPs

- they'll go back to IP #1 but if it fails, they'll retry to #2 and #3 before quitting

Of course, this doesn't help if (a) your clients are using IE6, or (b) it's not a web browser client.  But it would seem to provide all the ingredients of HA.


----------

