i'm planning to migrate my server from one hosting to another, hence I need to change the dns for my domain name. but the problem is, dns propagating takes a few hours to really complete. Problem is, my site has few thousands users and they enter data daily on my site. What is the best practice on server migration? because i don't want any non-synchronized or non-updated database later.

  • No offence, but I think you should post this question on serverfault.com Its the same kind of side like Stackoverflow but focused on server related questions. – user557757 May 29 '11 at 3:16

Place a notice on your website that you will be moving the site to a new server on at a specific date and time. Your slowest time is the best time to do it. At that time you can:

  • Take the site down and put up a "under maintainance" page letting users know the site is down and will bu back shortly.

  • Or put up a notice on the top of your pages letting people know your site is moving and the site can be viewed but no changes can be made while the move is happening.

The first option is a lot easier to do. But option two allows your users to at least continue to view information on your site while it is migrated.

| improve this answer | |

Ollybee's step 4 is important to take note of. Some ISPs take a long time to update their cached DNS (i.e. DAYS!), even if you have set the Time To Live (TTL) really low for the migration.

If you can and don't mind leaving the old server up for a few days with it connecting REMOTELY to the new server's database, then that's the best way to go.

Another option is to set up a subdomain like new.[domain].com and point it to the new server. Add a robots.txt for just this temporary subdomain that won't allow a search engine to index it causing you duplicate content issues. Let the users know about this subdomain by putting up a notice that says exactly when it's going to happen on your website (depending how often people visit the site, maybe a week ahead of time) or email out to the newsletter. In the notice be clear that if any of them have trouble visiting [domain].com right after the migration, they should try new.[domain].com, but that's it's only temporary. After the migration, take down the old server if you have to or better yet, put up a notice that tells people to visit new.[domain].com while the transition is happening. After a couple days or so, stop showing the website at new.[domain].com and put up a notice telling people the transition is over and not to use new.[domain].com. Don't forward it or people will still think they can visit your website at new.[domain].com.

Reading over that, it is pretty complicated, but I have had to deal with this situation before because I was unable to have the old server remotely connect to the new database.

| improve this answer | |
  1. Gracefully disable the site
  2. Dump your database
  3. copy and import the database to the new server
  4. alter the connection string on the old server to use new servers database
  5. restart site

You should be able of do this in a matter of minutes. DNS propagation will take longer but only one database will be updated so it's less of an issue.

If the size of your database or requirements of the site mean you are unable or unwilling to disable the site for a short time, then hosting the site and database on one server (which I assume is what we are talking about) is not the righ solution.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.