Search code examples
apachednsserverfallback

How to have a second VPS as fallback of another VPS?


This weekend I had an issue with my VPS, which totally broke! But still got sites of my clients in that VPS, right now it's being restored but it made me think of how can I avoid the downtime by having a second VPS as fallback.

Still I know know the term but not what it implies or can be done. Is it done through DNS or with the nameservers? Or what is the best recommendation I can get from you guys?

My VPS are: CentOs 7 + Apache, WHM + cPanel, domains provided by GoDaddy

Thank you very much!


Solution

  • You are looking for "DNS Failover". There are some online services that provides that. (Despite the disadvantages, it is my favorite for non mission critical services, see below).

    You may also want to hear the critics.

    DNS Failover is a service where the DNS server checks with certian techniques the availability of your servers, and when one of them fails to respond, the DNS changes the record to point to the other server.

    By now you can see why this solution is not good enough, browsers/computers may cache your initial server (now broken) address and talk to its IP even after it is down.

    Every alternative has its pros and cons, most of the reasonable simple solutions are Single Point of Failure. it all boils down to "who do you prefer to blame" or who should deal with the spof.

    One alternative is to have the server provider do the redundancy.

    See this on about Amazon solution.

    It also depends on your setup and what do you want to protect. If both server are in the same lan, you can simple set a floating IP address and let the router decide who's active, this method requires access to the router, and its caviate is that the router just pings, doesn't actually check the service, which is the same with most of the solutions.