Friday, November 7, 2014

A perfect idea when migrating a website from one server to another ;)

I listed one of the brilliant ideas that explains on the exact step that we should consider in moving a website from one server to another. I took this idea from Liquid Web so it is also my honour to give due credit to them. I documented this one to help my fellow developers as well analyse on why a site did not work to the destination server and it was perfectly working from the source server. ;)

1. The first thing we will do upon starting your migration is to lower all the DNS TTL values (Time to Live - a directive which informs the internet at large how often to check your DNS information) of all your hosted domains. This will allow us to minimize the downtime caused by a migration. The TTL value change will usually take about 24 hours to propagate throughout the internet. For more information, please view http://wikipedia.org/wiki/Time_to_live.


2. After the TTL's have been lowered, we will begin to match up all your software versions. The software we version match includes Apache, MySQL, and PHP, as well as their associated modules.


3. We will then begin moving your data from your old server to the new one. The data moved will consist of all accounts, user home directories, databases, and email. Your sites will remain online during this time.


4. Once your data has been migrated, and all your accounts have been restored, your migration specialist will ask you to look over the sites located on your new LiquidWeb Server. This is done either by visiting the site via IP address, or better, by modifying the hosts file on your home/office computer (you will be provided further instructions for testing at this time.) Please make sure that you test your sites thoroughly (including adding and editing pages and posts, leaving test comments, following links, and ensuring any custom forms or applications are working properly) before letting us know that you are ready to move on to the next step. This helps to ensure that your sites will work correctly when they go live.


5. After looking over your sites and letting your migration specialist know that everything is functioning properly, we will schedule a time and date for your final sync. During the final sync we will shut down several processes on your old server (Apache, email, cPanel) and copy any changed files, mail, or databases. This sync absolutely must be scheduled in advance as our schedule fills up quickly and we will likely not have an open time slot unless it has been reserved.


6. While the final sync is in progress we will change the DNS zone files on your old server to point to your new server, if the DNS is hosted locally. During the final sync you will experience some downtime, the duration of which will depend upon how many files are being moved, how much data is in those files, and how much of the content has been modified since the last data transfer.


7. Once the final sync is complete, we will ask you to once again check over your sites. If everything looks good, then you can change your DNS name server IPs at your registrar (if applicable,) and the migration will be complete.

During the testing phase, here is also a great tutorial on how to do it:

Here is a tutorial that explains how to edit your hosts file:

http://kb.liquidweb.com/dns-hosts-file/

The process of editing your hosts file is as simple as adding a few lines to a file through a text editor. What this will do is tell your browser what IP address you want to load a domain from instead of looking it up from a DNS server. Here are a few youtube videos that will walk you through setting up your hosts file:

For Windows 8:
https://www.youtube.com/watch?v=6HtODhWg_YA

For Windows 7:
http://youtu.be/psQW6GqM444?t=4s

For Mac OSX:
https://www.youtube.com/watch?v=GmEwA0XMCm8

* Please note: If you are using OS X Mavericks you will need to use `dscacheutil -flushcache; sudo killall -HUP mDNSResponder` to flush your DNS.

Another good resource for editing your hosts file, with pictures, is available here:
http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/