Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.

share|improve this question
    
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
add comment

migrated from stackoverflow.com May 29 '11 at 6:59

This question came from our site for professional and enthusiast programmers.

3 Answers

up vote 2 down vote accepted

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.

share|improve this answer
    
thanks a lot... i think option 1 is the best –  imin May 30 '11 at 14:25
add comment
  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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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