3

Welcome,

How can i use DNS server to create simple HA (High availability) of website ?

For example if my web-server ( for better understanding i use internal IP in real it will be other hosting companies)

192.168.0.120 :80 (is offline) traffic go to 192.168.0.130 :80


You have right, i use bad word "hight avability" of course i was thinking about failover.

Using few IP in A records is good for simple load-balancing. But not in case, if i want notice user about failure (for example display page, Oops something is wrong without our server, we working on it) against "can't establish connection".

I was thinking about setting up something like this

2 DNS servers, one installed on www server

Both have low TTL

on my domain, set up 2 ns records first for DNS with my apache server second to other dns

If user try connect he will get ip of www server using first dns, if that dns is offline (probably www server is also down) so it will try second NS record, what will point to another dns, that dns will point to "backup" page.

That's what i would like to do.

If You have other idea please share.

Reverse proxy is not option, because IP of server can change, or i can use other country for backup.

sysadmin1138
  • 135,853

3 Answers3

5

DNS is not the solution for high-availability failover.

Regardless of the TTL on your DNS records many clients will cache your site's IP address, and will not correctly failover when you change it.

For more comprehensive answers, see this question.

Alnitak
  • 21,641
1

You could use a reverse proxy

lrosa
  • 1,725
1

You can't do that in just DNS. You also need something to monitor the sites and switch the records between them when one fails (and the other is still alive). There are a number of commercial services that do that for you (I know DynDNS does under their Dynect brand) or if you manage your own DNS you could pull together some scripts or tools to do that, but it's not as trivial as it sounds.

Cry Havok
  • 1,905
  • 13
  • 10