You are not logged in! If you have not registered yet then click here to join the community!

TOLRA Community Forums


Go Back   TOLRA Community Forums > Blogs > TOLRA Micro Systems Limited Blog

Notices

TOLRA Micro Systems Limited Blog
Rate this Entry

Moving your site to a new server with minimum downtime

Submit "Moving your site to a new server with minimum downtime" to Digg Submit "Moving your site to a new server with minimum downtime" to del.icio.us Submit "Moving your site to a new server with minimum downtime" to StumbleUpon Submit "Moving your site to a new server with minimum downtime" to Google
Posted 01-02-2009 at 07:06 PM by Paul
Updated 02-02-2009 at 10:13 AM by Paul

There are times when you need to move a website between servers maybe because you are changing hosts or otherwise change its IP address, the following helps to reduce the time that both the old and new sites are operating in tandem.

Note: This method does assume that your current host provides sufficient access to edit your DNS zone, or your new host can take on the nameserver roll before starting to host the actual data.

Within the domains zone each entry will have a TTL (time-to-live) value, this will either be explicitly set for the entries or the default. TTL is the minimum time that data will remain cached in other nameservers and is given in seconds.

Code:
An example zone file:
$TTL 14400
example.com. 86400 IN SOA ns1.tolradns.net. hostmaster.example.com. (
2009012403 ;Serial Number
14400 ;refresh
7200 ;retry
2419200 ;expire
3600 ;minimum
)
example.com.    86400   IN      NS      ns1.tolradns.net.
example.com.    86400   IN      NS      ns2.tolradns.net.
example.com.    86400   IN      NS      ns3.tolradns.net.

example.com.    IN      A       192.168.100.10
example.com.    IN      MX      5       mail.example.com.
mail    IN      A   192.168.100.10
www     IN      CNAME   example.com.
The first step is to look up the current TTL value in the domains zone file, in this case it's using a default of 14400 seconds or 4 hours. Therefore any changes we make need to be made a minimum of 4 hours before the move.

So first thing we do is lower the TTL to a very small value, 60 seconds is a reasonable value, and reload the zone file.

Code:
$TTL 60
Once you are ready to move to the new server, copy the files and databases over then update the IP addresses within the zone file to be those of the new server.

Once the site is moved over then return the TTL value to a longer value in order to decrease load on the nameservers and ensure proper caching.

If the nameservers also need to be updated then they can be done after the move to ensure no interruption.

Some systems may cache DNS records for an extended period ignoring the TTL values give, for these the updates will happen in their own time but for the majority of users the move will be a minute or so.

Minimizing the time both systems are running for is especially important for dynamic sites such as forums or stores as the old site has to be switched off to avoid posts or orders being lost when the user places them on the wrong site because the user is still using the old cached DNS information.

In the case of changing hosting providers if your current host can't or will not shorten the TTL to aid with a quick move then your new host can create the zone information for your domain on their nameservers but using the current server IP.

You can now update your domains nameserver records to be those of the new provider, after 24 hours your new host is providing DNS services while your old host continues to serve the site. As your new provider now has control of the zone files they can lower the TTL values and move the site as described above.

We have done this many times over the years when taking on new hosting clients who need to minimize disruption.

Update: Added if you old host can't or will not help.
Posted in Web Hosting
Views 5785 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

Post a Comment Post a Comment

All times are GMT +1. The time now is 06:15 PM.