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? ).