3

I have a website with DNS pointing to my hosting account at ns1.a.com and ns2.a.com

I want to switch a hosting account (to ns1.b.com and ns2.b.com).

However if I simply change the DNS the site will be inaccessible until the change is complete, is there anyway to change host for a website without suffering from downtime?

0

3 Answers 3

13

I think you may be mistaken.

The site won't be inaccessible while the change is propagated to the other DNS servers. You will just likely have some people directed to the old site and some people directed to the new during the transition, or more accurately some will be directed to the old IP address and others to the new IP address. If you don't have concerns about this, you should be fine.

Just make sure to leave the site active at the old location until the transfer is complete, unless you have explicit reasons not to do this.

1
  • We did this earlier this year... as John says there will be some people that get directed to the old site and some to the new while the transfer is being completed. There will be no downtime as such.
    – Vince P
    Commented Jul 27, 2011 at 12:34
4

I do this all of the time for customers.

  1. Duplicate the site from host A onto host B.
  2. Cut over the DNS to point to host B.
  3. Cancel the host A account.

The only gotcha in all of this is if the site is very dynamic. If it's only you (or a small group) that are making changes, then just schedule accordingly. Larger groups may need to be locked out from making changes to the old site. Even more dynamic sites (heavily trafficked blogs w/comments) are trickier.

3
  • 1
    In that situation it might make sense to implement some functionality to re-point the site's back-end DB to the new location (which should take effect immediately) so that both sites are pointing at the same DB temporarily.
    – JohnFx
    Commented Jul 27, 2011 at 0:33
  • @JohnFx: Right, assuming that you can get outside access to the DB. Many hosting companies limit you to within-LAN access. I tend to run dedicated hosts so it's sort of a nonissue, but shared hosting is a different beast. Commented Jul 27, 2011 at 0:47
  • @JohnFx yes i can't afford to have people writing to both old and new DBs during the transition. my old host doesn't allow me to connect to my new DB. what other tricks can i employ to make sure everything is proper?
    – Pacerier
    Commented Jul 27, 2011 at 9:56
3

If you keep your files on old server, there will be no downtime.

DNS is cached heavily, and is only refreshed every hour (in most cases)

It does not matter what happens during that hour, because it's still on old server and your DNS record is still the same (only refreshed once a hour, and switched to new server with files ready), so you will have no downtime

2
  • but that's a problem. my old host doesn't allow me to connect to my new DB. so my data is at 2 places and people querying the data will be feeling like the data is screwed up (since they aren't interconnected). what solutions do you recommend?
    – Pacerier
    Commented Jul 28, 2011 at 7:53
  • just keep connecting DB to your old host. After switching DNS, wait few hours, switch DB and it will be OK for everyone
    – genesis
    Commented Jul 28, 2011 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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