amuck-landowner

How to have a VPS failover to another VPS if the first one goes down?

Minmeo

New Member
I have a VPS with static content and if it goes down I want another VPS with the same static content to be used to serve the information.

So my first VPS IP, let's say is 123.123.1.1 and then I have a VPS with another provider and it's IP is 124.124.2.2

What is the best way to have it go to the other VPS if the first one is down automatically? Is there a good program or script for this?
 

SrsX

Banned
Sounds like what you're looking for is something similiar to load balancers.

I know on services like cloudflare, you can enter multiple ip addresses for example, www.{site}.com loads to 1.2.3.4, and www.{site}.com also loads to 4.3.2.1
 
Last edited by a moderator:

marlencrabapple

New Member
Never tried this via DNS, but I just recently set up nginx to do something similar with dynamic content. You can tell nginx to use another location directive on an error. I have it set up in case a fastcgi process fails and throws a 502. Instead of displaying the error it just tries again with fcgiwrapper, since the script is compatible with both. You could definitely do something similar with purely static content.
 

KuJoe

Well-Known Member
Verified Provider
I've done this with both load balancing (varnish) and DNS (DNSMadeEasy). The most reliable method I've used was with the load balancer but the load balancer is a single point of failure still so DNS failover is the most reliable because it's multiple, completely redundant front facing servers. The downside to DNS failover is usually the cost involved and I've found that the heartbeat DNSMadeEasy uses isn't the most reliable so sometimes it will mark an IP as bad when it's not.
 

mikho

Not to be taken seriously, ever!
You still have to monitor the servers and update the DNS records if one goes down, at least with cloudflare.


Cloudflare will still serve both IPs which will give some users the error page instead.


I'm looking in on how to use the Cloudflare API to update DNS zones.


Reason that I'm looking at Cloudflare is because I "need" the ipv6->ipv4 conversion.
 

Minmeo

New Member
Thank you everyone. I will look more into this and if I figure it out in a simple way I might try to write a howto and share it here! :)
 
Top
amuck-landowner