-1

If my main server go offline for some reason for +1hrs, I'm planning to make a DNS change so users will access secondary server. It is not a perfect solution to decrease downtime but it is simple and would work. I'm not sure about its usefulness. So I have a question.

If I'm going to make a DNS change to an A record for my domain (changing from one IP to another), what percentage of users are moved over to the new info in 2hrs? (roughly)

I know this is a vague question and there are lots of variables but any input is welcomed because I had painful downtime experiences and don't want to experience it again.

Thanks

  • There are so many variables that there can be no answer - the number of DNS queries that will return new data before the propagation window elapses is completely unpredictable. – Falcon Momot Jun 19 '14 at 05:03

3 Answers3

3

In longer run it is difficult to scale infrastructure if you are dependent on DNS change everytime your host or 30% of all hosts are down for maintenance or a hacker broke them . So i suggest if your organization has budget you can -

  1. create a VIP (VirtualIP) on whatever layer 3 load balancer your IT Department has access to like F5, Cisco or you can use a software loadbalancer like HAProxy.
  2. once you have VIP in place make both of your servers (primary and secondary) pool member to the VIP
  3. Add an A record on your dns server to point whateverhost.com to VIP.

this way all requests will hit load balancer and load balancer will decide which server the request will be forwarded to . so when you want to bring down your primary server just disable the primary server pool member and loadbalancer will automatically route all request to secondary.

akash
  • 333
  • 1
  • 10
  • Thank you for your answer. Would providers like Softlayer be overkill? How much would this setup cost roughly? I ask because providers tend to try to sell much more than I need. – user3722246 Jun 11 '14 at 18:42
  • sure you can do that, or you can try amazon ec2 with amazon elastic loadbalancing. the later is economical – akash Jun 12 '14 at 02:58
2

If you want to use this strategy, the most important thing is to make sure that the TTL (time-to-live) of the affected DNS records is short. The TTL is the number of seconds for which clients (and their resolvers) will cache the address they get from your nameservers.

You can either change the TTL of a single record

www.yourdomain.com.       IN  A  192.0.2.1   ; uses default ttl

becomes

www.yourdomain.com.  300  IN  A  192.0.2.1   ; ttl = 300 seconds (5 minutes)

or you can set the default TTL for the whole domain in its SOA record by adding a line at the top of the zone file of the form

$TTL 5m    ; i.e. 300 seconds

Once you update the record on your nameservers, all clients will get the new value after the TTL has expired.

Flup
  • 7,688
  • 1
  • 31
  • 43
1

In theory DNS records are cached for the duration of the TTL field you specified. If that value is say 3600 second then 1 hour after you changed the IP-address all cached records are expired and every visitor should be resolving your domain to it's new ip-address.

In practice some will pick up the change seemingly instantly and some ISP's run caching nameservers that routinely ignore TTL values. See for instance what-percentage-of-nameservers-honor-ttl-these-days?

HBruijn
  • 72,524
  • 21
  • 127
  • 192