Transferring a production server from NYC2 to NYC3 with minimal downtime

January 22, 2015 1.7k views

I have a production server that I would like to transfer from NYC2 to NYC3. The problem is that we will be issued a new ip address once we switch. With the new IP address we would need to update our DNS records which of course would mean it would take some time for those changes propagate.

The best strategy I've come up with so far is boot up the new vps - and point the old vps to the new vps's database while we wait for the DNS to switch over.

My question is: What strategies can I use to make this switch as smooth as possible with zero to minimal downtime (ie. less that 30 minutes downtime)?

3 Answers

This is a good plan:

The best strategy I've come up with so far is boot up the new vps - and point the old vps to the new vps's database while we wait for the DNS to switch over.

If you set up your new droplet. Then point your old droplet's scripts to use the database on your new droplet you can then switch the DNS over and wait for it to propagate before destroying the old droplet. Using this method you should be able to achieve 0 downtime. If your scripts change any files within your filesystem you may need to sync the files on your old droplet with your new droplet to ensure any changes during the transition are reflected.

You can also use iptables to port forward db ports to the new droplet till DNS changes propagate.

Here is a tip, open a free account at Cloudflare, set-up your domain name (no downtime if you set it using cloudflare Wizzard), once the domain is hosted with cloudflare (Fully propagated over DNS networks) your records will be already added to the dns manager on cloudflare, then you can transfer the droplet image to NY3, start your server, be sure everything is working ok and then go to Cloudflare's DNS manager and change the A record you use for that server ie:

3.3.3.3 -> db.mydomain.com

DNS changes within cloudflare are almost instantly made. better yet, create a cname record and redirect it to an A record for the hosts you use, ie:

cname: db.myapp.com -> mysqlhost1.myapp.com
A: mysqlhost1.myapp.com - > 1.1.1.1
A: mysqlhost2.myapp.com -> 3.3.3.3

Change cname db.myapp.com from mysqlhost1.myapp.com to mysqlhost2.myapp.com and your change is made almost instantly.

Thanks @EpicCDN I really like your approach - seems easier than setting up a master slave.

  • You welcome! actually it is a lot easier no doubt, I use same config to change/enable/disable front end servers when any datacenter in DO has any latency or big issue.

Have another answer? Share your knowledge.