DNS Migration – What DNS Settings to Use to Migrate Domain from One Server to Another

domain-name-systemttl

I am going to migrate a site from one server to another. The site has a good bit of realtime transaction activity reading/writing to a backend database.

I believe I should ratchet down the TTL in the DNS on the domain so that once I am ready to make the switch all I need to do is update the nameservers assigned to the domain name and traffic will begin to move to the new server.

If my understanding of the process is correct, what should I set the TTL to on my current server?

Do I also need to set the "refresh", "retry", and "expire" values on my old server? If so, what should they be set too?

Thanks

HERE's MY PROCESS

www.blah.com is hosted at hosting service provider "hoster

www.blah.com has its ns1 record as ns1.myFirstNameServer.net and its ns2 record as ns2.myFirstNameServer.net

I setup a new name server with ns records as ns1.aNewNameServerIdecidedToBuy.net and ns2.aNewNameServerIdecidedToBuy.net — its IPs point to my current server at current "hoster"

Both my name server domains (myFirstNameServer.net and aNewNameServerIdecidedToBuy.net) are setup and reside with my registrar in their dns setup — its IPs point to my new server at new "hoster"

Once I am ready to make the switch, I will logon to my registrar and change the nameserver setting on www.blah.com as follows:

  • from ns1.myFirstNameServer.net to ns1.aNewNameServerIdecidedToBuy.net
  • from ns2.myFirstNameServer.net to ns2.aNewNameServerIdecidedToBuy.net

Best Answer

To keep things simple and do one thing at a time, you should not change your domain's NS records during this migration. If you want to migrate the web site and also migrate the authoritative DNS server, do it in 2 separate steps. To migrate the web site, change only the A and AAAA records.

A conventional "low value" TTL to set on the A and AAAA records is 300 (5 minutes).

If you can operate both servers at the same time for a short period, then you can do even better than a DNS-based migration. You can set the old server to proxy requests to the new server, so that clients which still contact the old server get their requests forwarded to the new server. This is easy to achieve with Apache with ProxyPass.

Later, if you want to move the DNS hosting, change the NS records and change the delegation in the parent zone (i.e. make the change at your domain's registrar). It is ideal if you can deploy the zone in the new servers ahead of time and leave both sets of nameservers serving the domain for a period of time.

EDIT: Details about ProxyPass

This Apache config snippet, placed in the <VirtualHost> section for your server, or directly in server config if there is no <VirtualHost>, will allow the old server to forward all requests to the new server:

<Location />
    ProxyPass http://www.example.org/
</Location>

You normally should have ProxyPassReverse with ProxyPass but in this case it can be omitted since it would have no effect because the old site and new site have identical ServerName.

You probably want to remove any other <Location>, Alias, RewriteRule, or other URL-mapping directives from the old server config at the same time to be certain that the proxy rule and only the proxy rule gets processed. (Keep a backup around, of course, in case you need to back out of your migration!)

Make sure the old server knows the correct new IP address for the web site's domain, otherwise it will proxy the request back to itself!

Related Topic