Minimising downtime when transferring websites from one server to another

Over the years, I’ve needed to do a lot of transfers of websites from one server to another.  I’ve found the following is the best way to do it for critical sites where you want to minimise downtime.  The red section is best done late at night or when the site is quiet and as quickly as possible so as to minimise disruption

  1. Set up space on new server
  2. Copy website files to new server
  3. If necessary, update config files on new server so that the website accesses data from the old one
  4. Update hosts file to test website on new server
  5. Test website on new server thoroughly
  6. Set up database user(s) on the new server and copy the database over and attach to test.  You may need to use this to re-attach users correctly on SQL Server
  7. Update the config file on the new server to point to the new database(s)
  8. Test that it is working again
  9. You may need to redo some of steps 2-8 a couple of times if things get changed on the original server while you are testing
  10. Remove hosts file entry used for testing
  11. Ensure that the firewall(s) allow access to the DB on the new server from the old one
  12. Once you are ready to finalise the transfer: Detach the database(s) on the old server or backup and detach
  13. Copy the database(s) to the new server (you may wish to zip them for transfer)
  14. While the database(s) are transferring, update the config on the site on the old server to connect to the new one
  15. Re-attach or restore the database on the new server.  You may need to re-attach users again
  16. Test that site is working on old server
  17. Re-set up hosts file entry for testing
  18. Re-test that site is working on new server
  19. Update DNS entries/name servers
  20. Remove hosts entry again
  21. If possible, test on another machine and connection which won’t have the DNS settings cached.  If not, wait for propagation and re-test

Whilst I primarily use this these days for IIS/MS SQL Server sites, it does work equally well for php/MySQL or any other platforms.  Also, although I am referring to sites on a single server, the same should also work for transferring between clusters.

Leave a Reply