Scope of the question
This question is solely about getting a client requesting a domain:
example.com to one of the two available servers. How it is handled from there on, is another problem to solve and should therefore not be mentioned in an answer.
My available tools are two dedicated servers (
server A and
server B) distributed in two different data centers (
data center A and
data center B) located in another physical location. The purely fictional IP address of
server A is represented as
a.a.a.a and the IP address of
server B is represented as
b.b.b.b. Both servers come with a Linux distribution which does not really matter.
Since I want to take things in my own control, I do not wish to use any 3rd party services (managed DNS, CDN etc). Thus these are my only tools.
The disaster I am counting on is a hydrogen bomb annihilating one of the two data centers used a week after I setup things correctly on both servers.
I want my domain
example.com to be available at all times, although I wouldn't bother for a few seconds or perhaps even a few minutes downtime since the servers are so reliable that they might not even crash more than once a year. Also a simple page displaying that "we are busy solving the problem" could extend this acceptable downtime to an hour or so.
My fixed solution
It has been a while since I asked this question, and now I have a reasonable redundant setup. Since it is closed, I cannot post this as an answer :(
Both servers turn out to have equal DNS records for the
# DNS records for both server A and server B example.com. NS ns1a.example.com. example.com. NS ns1b.example.com. example.com. NS ns2a.example.com. example.com. NS ns2b.example.com. ns1a.example.com. A a.a.a.a ns2a.example.com. A a.a.a.a ns1b.example.com. A b.b.b.b ns2b.example.com. A b.b.b.b www.example.com. CNAME example.com. example.com. A a.a.a.a example.com. A b.b.b.b
Both servers got scripts running checking eachother for availability every minute. Both servers are name-servers of the example.com domain, so they can both change the DNS records. In case of trouble, the server which is still online will detect this, and remove the other server from the DNS records. Next to this, while the other server is still in the DNS records, browsers will automatically fallback to the other server within 2 seconds (tested with Mozilla Firefox)! Which is a really useful feature.
server A had 'authority' over
example.com I did not know how to add
server B as being able to control the DNS. Turns out that you can just add records for any domain, but they are only respected if the one who registered the domain first with DNS records adds this server as a nameserver with 'NS' in the DNS records.
I hope this will be of some use to somebody with a similar problem.