Transfer Your Websites with Minimal Downtime using DNS and WHM
Warning: Your use of the directions in this post is entirely at your own risk! The author will not be held responsible for any damages or loss/corruption of data as a result of following these directions. Author is not affiliated with KnownHost in any way.
PLEASE read this guide in full BEFORE you take any action described here.
Before You Begin
This guide will help you move a website from your old server provider to your new KnownHost server with minmal service disuption. In order to use this guide, you must meet all of the following requirements:
While you still need to do this process to have your domain's name servers permanently moved to your new server's addresses, this guide will help you avoid the "up to 48 hour downtime" scenario when you transfer a domain. Instead of waiting for the changes to your domain's name servers to propagate through the global DNS system, you will use the old server's DNS server (presumably BIND) to act as a connection relay to get your visitors to their correct destination on your new server.
Throughout this guide -- to keep things straight -- I will use the terms Old Server and New Server when giving directions (note the colors).
This guide will show you how to transfer a single domain. To move multiple domains, simply repeat these directions for each domain to be moved.
These steps are only effective if you follow them before you transfer a domain.
Before you begin this operation, both cPanel installations should be updated to the most recent version on their branch as this often will avoid transfer problems.
Determine the Domain's Existing DNS Settings
On the Old Server, go to the WHM for the server, which should be accessible at:
On the main screen that appears, find the DNS Functions button and click on it. On the next screen that appears, click on the Edit DNS Zone button.
Next will be a screen that shows all the available domains. Choose the domain you want to start with, select it, and click on Edit.
This is the DNS screen for this domain. There will likely be many entries here underneath the zone file header. Each of the entries will look similar to the following:
[Broken External Image]:http://img250.imageshack.us/img250/6681/image4hn5.gif
The first box is the name that is being defined. The second box defines the "time to live" or TTL value for that name. This value exists to help DNS clients cache information about internet names so that they do not need to constantly ask the DNS servers for the information they need to make connections. The third box is a drop-down that defines what kind of record this is (more on this in a moment). The fourth box (in all records except MX records) defines the value of the record, in this case and IP address (in MX records there is a fifth box which is the value).
There are various types of DNS records (you can see them all in the drop-down box). It is critically important that records maintain their proper type, so don't change any of them. The records we will deal with in this guide are A entries. A entries take a name and turn it into an IP address. The A entry for the domain is pictured in the example above. The domain itself and each subdomain will have an A entry at least.
You need to find the A entry in the list for your domain (as like the one pictured above). Do not change anything! You're just looking for information at this point. What is important that you find is the TTL value for that A entry. In addition, if you have any sub domains, find those TTLs as well.
The TTL value is the number of seconds that a DNS client will cache the information in that record before it expires and the client must ask the server for new information. Common values for A entries are 86400 seconds (24 hours) or 14400 seconds (4 hours), depending on the type of entry it serves.
The maximum value of the TTLs you have collected will determine how long you must wait before you begin your transfer. If you are a little slow at division, you can use Google's calculator to show you what 86400 seconds in hours is (replace 86400 for the value you have to convert).
So now you know the number of hours? Good.
For this example, we will presume that the maximum TTL on an A entry on our domain is 86400 seconds or 24 hours.
Now -- we are still on the Old Server DNS screen for this domain -- for each of the A entries, replace 86400 or 14400 with 900 (which is 15 minutes) and save the changes to the DNS zone. Be careful! Only change the TTLs for the A records, not any other data.
What this does is says to DNS clients: the next time you check in with us (up to 24 hours since the last time you did), we want you to start checking in with us more frequently, 15 minutes to be exact, for updated DNS information.
Now, go ahead and logout out of WHM. You must now wait at least 24 hours (or however long the maximum TTL was) before you proceed to the next step. This will allow time for all of the millions of DNS clients out there to allow their existing record for your domain to expire as scheduled.
The next time a user wants to access your domain, the DNS client will sense that it has expired information and ask the server for new data. When the new data is sent to them, the new expiration schedule is included, which will make the data expire very quickly and require the client to check in more frequently.
While you are waiting, use this time to make the New Server production-ready, meaning that you have your web server, database, and any other servers you need completely set up, configured, and ready to go (waiting for your account data). The less you have to do later, the less downtime there will be.
Conducting the Transfer
Now that you have waited the amount of required time, you now can begin working on the transfer itself. First of all, you need to determine is the domain you are transferring is a static website (where the content is not dynamically generated or stored in a live database) or a dynamic website as this will affect your next step. In general, all PHP/MySQL style websites are dynamic in nature.
If the website is dynamic, you want to make sure that the database entries and files themselves are not going to be changed during the transfer process as this will leave behind new content on the Old Server. So you will have to close the website to its users to prevent any changes from happening. The most graceful way of doing this is to replace the index file in the public_html directory with a notice saying that the website is being moved and that it will be back online in a short while. If for whatever reason you do not want to do this, you can suspend the account through WHM instead (although this will leave a user-unfriendly message to the visitors).
If it's a static website, this is not necessary. You just have to make sure the website owner is not making any changes to the static files (through FTP) while you are doing the transfer. At the end of this process, it will appear as if there was no downtime at all on a static website.
To transfer the files easily, you will use WHM's transfer facility. In order to do this, the firewall on the New Server must have the SSH port of the Old Server open. So for example, if the SSH port of the Old Server is 22, then the firewall on the New Server must have port 22 open for the duration of the transfer (although you can close it again when you are done). Directions on how to do this will depend on the firewall you are using, if any. Check your firewall documentation for more details. Remember to reload your firewall rules!
Warning: Your use of the directions in this post is entirely at your own risk! The author will not be held responsible for any damages or loss/corruption of data as a result of following these directions. Author is not affiliated with KnownHost in any way.
PLEASE read this guide in full BEFORE you take any action described here.
Before You Begin
This guide will help you move a website from your old server provider to your new KnownHost server with minmal service disuption. In order to use this guide, you must meet all of the following requirements:
- You must be the root user on BOTH the new and old servers.
- Both servers must have a recent version of cPanel/WHM installed and working.
- You must be able to keep the old server online for approximately 3-4 days after you are done transferring (meaning you're not being immediately disconnected).
- You must have a sufficient level of experience with server administration to follow these directions. If you read something here and say "woah what now?" then you are probably ill-suited to do an operation like this.
While you still need to do this process to have your domain's name servers permanently moved to your new server's addresses, this guide will help you avoid the "up to 48 hour downtime" scenario when you transfer a domain. Instead of waiting for the changes to your domain's name servers to propagate through the global DNS system, you will use the old server's DNS server (presumably BIND) to act as a connection relay to get your visitors to their correct destination on your new server.
Throughout this guide -- to keep things straight -- I will use the terms Old Server and New Server when giving directions (note the colors).
This guide will show you how to transfer a single domain. To move multiple domains, simply repeat these directions for each domain to be moved.
These steps are only effective if you follow them before you transfer a domain.
Before you begin this operation, both cPanel installations should be updated to the most recent version on their branch as this often will avoid transfer problems.
Determine the Domain's Existing DNS Settings
On the Old Server, go to the WHM for the server, which should be accessible at:
Code:
https://hostname:2087/
(replace "hostname" with the hostname of the server)
Next will be a screen that shows all the available domains. Choose the domain you want to start with, select it, and click on Edit.
This is the DNS screen for this domain. There will likely be many entries here underneath the zone file header. Each of the entries will look similar to the following:
[Broken External Image]:http://img250.imageshack.us/img250/6681/image4hn5.gif
The first box is the name that is being defined. The second box defines the "time to live" or TTL value for that name. This value exists to help DNS clients cache information about internet names so that they do not need to constantly ask the DNS servers for the information they need to make connections. The third box is a drop-down that defines what kind of record this is (more on this in a moment). The fourth box (in all records except MX records) defines the value of the record, in this case and IP address (in MX records there is a fifth box which is the value).
There are various types of DNS records (you can see them all in the drop-down box). It is critically important that records maintain their proper type, so don't change any of them. The records we will deal with in this guide are A entries. A entries take a name and turn it into an IP address. The A entry for the domain is pictured in the example above. The domain itself and each subdomain will have an A entry at least.
You need to find the A entry in the list for your domain (as like the one pictured above). Do not change anything! You're just looking for information at this point. What is important that you find is the TTL value for that A entry. In addition, if you have any sub domains, find those TTLs as well.
The TTL value is the number of seconds that a DNS client will cache the information in that record before it expires and the client must ask the server for new information. Common values for A entries are 86400 seconds (24 hours) or 14400 seconds (4 hours), depending on the type of entry it serves.
The maximum value of the TTLs you have collected will determine how long you must wait before you begin your transfer. If you are a little slow at division, you can use Google's calculator to show you what 86400 seconds in hours is (replace 86400 for the value you have to convert).
So now you know the number of hours? Good.
For this example, we will presume that the maximum TTL on an A entry on our domain is 86400 seconds or 24 hours.
Now -- we are still on the Old Server DNS screen for this domain -- for each of the A entries, replace 86400 or 14400 with 900 (which is 15 minutes) and save the changes to the DNS zone. Be careful! Only change the TTLs for the A records, not any other data.
What this does is says to DNS clients: the next time you check in with us (up to 24 hours since the last time you did), we want you to start checking in with us more frequently, 15 minutes to be exact, for updated DNS information.
Now, go ahead and logout out of WHM. You must now wait at least 24 hours (or however long the maximum TTL was) before you proceed to the next step. This will allow time for all of the millions of DNS clients out there to allow their existing record for your domain to expire as scheduled.
The next time a user wants to access your domain, the DNS client will sense that it has expired information and ask the server for new data. When the new data is sent to them, the new expiration schedule is included, which will make the data expire very quickly and require the client to check in more frequently.
While you are waiting, use this time to make the New Server production-ready, meaning that you have your web server, database, and any other servers you need completely set up, configured, and ready to go (waiting for your account data). The less you have to do later, the less downtime there will be.
Conducting the Transfer
Now that you have waited the amount of required time, you now can begin working on the transfer itself. First of all, you need to determine is the domain you are transferring is a static website (where the content is not dynamically generated or stored in a live database) or a dynamic website as this will affect your next step. In general, all PHP/MySQL style websites are dynamic in nature.
If the website is dynamic, you want to make sure that the database entries and files themselves are not going to be changed during the transfer process as this will leave behind new content on the Old Server. So you will have to close the website to its users to prevent any changes from happening. The most graceful way of doing this is to replace the index file in the public_html directory with a notice saying that the website is being moved and that it will be back online in a short while. If for whatever reason you do not want to do this, you can suspend the account through WHM instead (although this will leave a user-unfriendly message to the visitors).
If it's a static website, this is not necessary. You just have to make sure the website owner is not making any changes to the static files (through FTP) while you are doing the transfer. At the end of this process, it will appear as if there was no downtime at all on a static website.
To transfer the files easily, you will use WHM's transfer facility. In order to do this, the firewall on the New Server must have the SSH port of the Old Server open. So for example, if the SSH port of the Old Server is 22, then the firewall on the New Server must have port 22 open for the duration of the transfer (although you can close it again when you are done). Directions on how to do this will depend on the firewall you are using, if any. Check your firewall documentation for more details. Remember to reload your firewall rules!