When my A web server gets unplugged, how do I automatically redirect all the users to my B web server in another city, and vice versa?
When my A web server gets unplugged, how do I automatically redirect all the users to my B web server in another city, and vice versa?
A load-balancing switch does what I want, except I can't figure out how to get it to work unless both web servers are in the same building.
The high-availability clustering systems do what I want, except I can't figure out how to get it to work unless both web servers are in the same building.
The accepted answer to " redirect to a static page on another web server when main web server is down " seems to support web servers in 2 different cities. But how does installing a piece of software on one box help me after that box is unplugged?
How do round-robin DNS and content-delivery networks (CDNs) do it?
I suppose one approach starts out something like:
- I get the IP address of each and every one of my physical web servers.
- I put the IP address of each and every one of my physical web servers into the DNS record for the single domain name of "the" web site (multiple A records or AAAA records or both).
- ... then what do I need to do?
I suppose another approach starts out something like
- I use some dynamic DNS provider for the single domain name that I expect users to type into the web browser
- I set up a cron job on each web server that periodically tells the DNS provider its own IP address (update the A record or AAAA record) or its own domain name (update the CNAME record or DNAME record).
- ... then what do I need to do?
(For now, I'd be happy if my users got a static web page with my contact information and a footnote that says "the main A web server seems to be down" whenever web server A is unplugged. That's already much better than the current system that merely gives a "server not found" error. Ideally I'd like A and B to be fully synchronized and apparently identical -- but that's something for another question: equivalent to CDN but for dynamical content? ).
Sounds like you may be looking for a Global Server Load Balancing (GSLB) solution. GSLB usually uses "smart" DNS to direct users to different servers based on a number of parameters (i.e. server unavailable, high load, ip geolocation, etc).
As an example, say you have two web servers, one out west (10.10.10.1/24) and one east (10.20.20.1/24). Say your web hostname is www.connect.com.
GSLB can be configured to be your DNS or as a CNAME. Either way, a user types in www.connect.com, the dns query is directed to the GSLB solution and it responds with either 10.10.10.1 or 10.20.20.1 depending on parameters. The GSLB usually sets a low TTL so the client host/browser caches the response for as little time as possible. There are different ways to address persistence but that goes beyond the scope of this scenario.
Lets say the east (10.20.20.1) web server goes down. GSLB usually implements health checks to check the health of the backend nodes. GSLB notices east is down and all subsequent dns records for www.connect.com will resolve to 10.10.10.1.
If you have a local server load balancing solution (SLB), then you could set it up such that www.connect.com is a VIP/VS (say 192.168.1.1/24) with two backend nodes (10.10.10.1/24 and 10.20.20.1/24). Technically the nodes could be in different network segments so as long as the local SLB can reach the other server. The SLB solution may be smart enough to redirect users to an available server if a backend node goes down. If you're using F5 LTM, then you could easily create an iRule for such an event. Citrix NetScaler and other SLB solutions should also have similar capabilities.
RR DNS does not work in this case. RR DNS has no intelligence built in. The only way to accomplish the use case with DNS is to use some sort of "smart" dns through a GSLB (or similar) solution.
CDN usually implement GSLB/SLB solutions to ensure HA for their customers.
You want to look into global load balancers like F5 and Cisco make. Basically they do some tricks with DNS if the partner is down and if the partner is up they feed the data across to the otherside through the load balancer.