Switching hosting providers can be a stressful experience. There is the danger of having problems that cause significant downtime. Even when everything is done well, there is still a risk of site downtime. Here are the 11 best tips to show you how to switch hosting provider without downtime.
1. Prepare, Prepare, Prepare
The first thing you should do is to prepare, prepare, and then prepare more. Being prepared for the change is the best way to minimize downtime. Murphy’s Law says that everything that can go wrong will go wrong and when you aren’t prepared, this seems to happen with more regularity.
Many of the steps discussed in this article can really only be done well when you have the time needed to prepare things and ensure that they are working properly. It can generally take 24 to 72 hours to migrate a site successfully. If you do not properly prepare, this can all be down time.
Part of the preparation procedure should be to contact customers and let them know that you are switching hosting providers and there might some downtime. This helps customers stay in the loop.
2. Don’t Cancel Your Old Host
Because it can take 24 to 72 hours to properly move over to a new site, don’t cancel your old hosting for at least 72 hours. This means that you really shouldn’t attempt to move the site on the last day of the billing cycle. You’ll want to ensure that clients and customers visiting your site are looking at your site and not error pages.
3. Set DNS to Minimum TTL
Still in the preparation phase, you should set your DNS to the minimum TTL possible. This should be done as far as practicable in advance. The TTL is the time to live. This is the time that you tell others that your DNS values are good for. Some TTL values are as high as 7 days! 24 hours is a very common TTL value for DNS. The higher the TTL value, the longer the older records are kept and the slower it is for your site to propagate across the net. Setting a TTL value to 300 seconds a week before the changeover and then changing it to 60 seconds 24 hours before changing hosts is a good way to lessen downtime.
4. Enable SSH on New and Old Host
Depending on your host, you might be able to have them enable SSH. You’ll need it on both your new host and your old host. If you can get both SSH on both hosts then you can use Rsync to copy over all of your files and ensures that all files are the same on each server. It requires command line knowledge but it’s powerful and many basic commands are just cut and paste.
5. Backup Your Files
If you have SSH and Rsync available, then backing your actual web files is easy. Just Rsync and your files will be in the same place on your new server. Since the two servers are connected with very high-speed connections, it’s fast and easy.
If you have a control panel, then you can use it to make a zip file of your public HTML directory. You can download this zip file for later uploading to your new host.
If you don’t have a control panel or ssh access, then you will need to download files individually via FTP. This can be very time-consuming and needs to be done as you begin the process.
Database backups are a different challenge. Your control panel provides the ability to create database backups. You can also use phpMyAdmin to make backups. You can even use the command line to make backups. The database is more important than your files themselves, especially if you are using a CMS like WordPress.
6. Upload Your Files to New Server
If you use Rsync then you have already uploaded your files. If you used your control panel, then you’ll upload the zip file to your server control panel and let it extract the files. If you used FTP then you will upload each individual file. Again, be prepared for a long wait.
7. Setup Databases and Check DB Connections
You will setup your databases on your new host and then you can upload the database backups. If possible, keep the database names, usernames, and passwords the same in order to minimize the time required to change database connection information. This is important when minimizing downtime since there is less chance of an error that will cause downtime.
8. Ensure Files are Accessible and Permissions are Properly Set
This step is crucial and can only partially be performed without having the server fully up and going. First, ensure that file permissions are correct for your server. 755 is a common web file permission, but your new host might be different. If you have any files without the correct permissions then you run the risk of site downtime. Make sure that the files you uploaded are in the correct web accessible folders. Make sure that all database connection information is correct. Double check it.
9. Change DNS to Point to New Server
You are now ready to go live and this begins with setting your new DNS. Set the DNS to your new servers as instructed by your new host. It shouldn’t take long for your site to begin propagating if you used a 1 minute TTL.
To more quickly check for errors, change your personal computer’s DNS settings to Google’s Public DNS. It’s 18.104.22.168 and 22.214.171.124. Some ISPs are very slow to update their DNS even if the TTL value is low. You should also flush the DNS on your desktop so that old records are gone. In Windows, run the following command as administrator: ipconfig /flushdns.
To help ensure that you are working on your new site, one suggestion is to put a little mark of some sort in your site’s footer to let you know if you are working on the new site or not.
10. Ensure Everything is Working
The next step is to ensure that everything is working. If it isn’t, then find out why it isn’t working. If things aren’t working then you have entered downtime territory. Ensure that files are accessible and that permissions are correct.
11. Cancel Former Hosting
If everything is working and at least 72 hours has passed since you changed your DNS over then you can go ahead and cancel your old web hosting. You’ve made a successful transition and your new site is now functional. Hopefully, it was without hiccups because you learned how to switch hosting provider without downtime.
This is all there is to making a successful transition to a new host with minimal downtime.