Jan
15th

Moving A Server – Things You Need To Know

Filed under Dedicated Servers, Server Tips | Posted by Gary

Over the years I’ve been involved in a lot of server moves and I’ve been asked to ‘fix’ a few that have gone awry. By far the biggest problem has always been lack of planning. If you plan your server move carefully then you have every reason to believe it will go fairly smoothly. If you don’t plan at all then there’s a very good chance that you’re going to strike some problems. Here’s a summary in point form of the procedure I follow when moving a server.

Firstly, I should say that moving a server is not necessarily a trivial thing. Moving files and importing/exporting databases is fairly easy but you need to consider everything including whether your new site provides the same environment that your old site had. Does it run the same version of PHP? Will your site run okay with MySQL 4 or does it use some of the features that are only available in MySQL 5? If it’s a very basic site then you should have no issues at all and the move will be quite easy. If you have scripts that use PHP, MySQL or Perl though you might find that there are some things missing or different at the new site that will need to be addressed before you finalise the move.

* The easy way is to do a complete backup if you are using CPanel and then restore that backup on the new server. If you can’t do that, then you need to follow the steps I’ve outlined below.

* Take a backup of the old server and check it. One of the problems you may have is with large databases. Online database programs such as phpMyAdmin can only back up a certain amount of data before your browser or the web server times out. If this happens then you need to either login with SSH and do a ‘mysqldump’ at the commandline or ask your web host to do it for you. Keep in mind that if the web host does it for you, your data will only be current to the time the web host exported it for you – so if it’s a fairly dynamic site or you have active forums you should be (a) warning your members that some posts may be lost and (b) arranging to get this export done as one of the final steps before you actually move the site.

* If you are using PHP and/or MySQL, check the versions of both of those and also the PHP configuration. With a phpinfo() command you can get a full list of all of the features and extensions that are compiled into PHP. This is another common problem … where one server runs PHP4 and the other has PHP 5, or some of the extensions on the old server aren’t compiled into PHP on the new server.

* If you have any Perl scripts then you need to check that all the Perl modules your site uses are installed at the new site. Perl has a very large range of modules, so there’s a chance that some may need to be installed at the new site.

* The next hurdle to get over is the fact that you need to set up the new server using an internet address that points at the wrong place. What I mean is that if you have www.yourserver.com (the old server) and the new server is going to use the new address, you need to be able to set the new server up as www.yourserver.com even though that address is pointed at the old server. What I generally do is use the Windows hosts file. It is located in your system32 directory in drivers/etc. You can add the web address and the IP of the new server, then flush your Windows DNS by going to a Windows commandline and entering the command ‘ipconfig /flushdns’. Then, close and re-open yourweb browser and it should bring up the new server when you enter the web address. If you need to look at the old site again you can simply remove the entry in the hosts file, flush the DNS again etc. The idea though is that once you have the backup you shouldn’t need to look at the old site again until you’re ready to put up a ‘we have moved’ page.

* Next up, we copy all the files up to the new server, import the database and see if it is all working. You may find some problems or glitches – give it a good test and if you have any forms or scripts that do file uploads, image creation etc, make sure you check those as well.

* Once you’re satisfied that everything looks to be working, you can change the main page of the old site to read something like “We have moved. It may take up to 72 hours for the change of DNS address to reach you so please be patient. Once the new DNS details reach you, you will be able to see the site again”.

* The final step is to change the nameserver addresses at your domain registrar (the place where you registered your domain). That will tell the DNS that your server has moved to a new location.

So, there you have it. I haven’t written this in ‘laymans’ terms because I honestly think that anything but the most basic server moves should be left to the ‘professionals’. If you understand everything I’ve said in this post then by all means, do your server move. But if it all looks a bit too hard then there’s a good chance that it will be too hard for you, in which case you should have an experienced IT pro do the server move.

You must be logged in to post a comment.