Yesterday I moved my WordPress network from one VPS in Chicago to Atlanta (different VPS hosting company). I like using a VPS because it maintains my illusion of being in control of my server.
*Drinks more coffee*
Surprisingly it went well. Except for missing a couple of PHP modules I had no problems and the site has been stable overnight.
If you plan to do this then give this Codex article a read. Of course I didn’t read it myself, it’s much more fun for me just winging it.
Create and configure my new VPS
I installed an image of Ubuntu 13.04 and made sure SMTP was configured to work. Apache2, PHP, mysql and mod_ssl were added and activated as well.
That was a surprise for me. The default image installs a ton of stuff that I don’t think I’ll ever need or want. I would have preferred to use a 14.04 LTS image (not available, too new) but that one is still maintained so it’s all good.
Creating the new empty database was straight forward. I used the same database name and user from the original VPS setup. Configuring the vhosts was just a matter of copying the old config files and making sure the certs and directories are all preserved.
Set DNS TTL on stun
My default DNS TTL (time-to-live) is 1800 seconds. I wasn’t sure if this would go well or not so I made the TTL 300 seconds (5 minutes). I didn’t change any IP addresses but if I broke something and couldn’t fix it then I was looking at only 5 minutes for it to come back to life.
Copy the files and database
My WordPress network has around 1.4 GB of file data from the last 7 years or so and the mysqldump was about 70MB . The file copy was just scp -r and the mysqldump command was just for that one network database.
Importing the database was just
zcat dumpfile.sql.gz | mysql -u name -p databasename
Once that was all done I updated my DNS IP and waited.
And I waited. And waited some more.
I could see in my access log that my new site was getting hits but I was still hitting my old web server (I was tailing the old logs in another windows) well after 5 minutes.
What the heck? It’s DNS. Setting the TTL just works. Except when it doesn’t.
I was using Google Chrome and that has it’s own application level DNS cache. It has a DNS cache that apparently doesn’t honor the TTL on the record.
Once I cleared that cache then I could see myself hitting the new IP address.
Nothing broke! Fantastic.
Next steps
Once I’ve confirmed that I have moved everything off the old VPS and onto the new then I’ll rebuild the old one and might re-do this whole exercise in the other direction. I’m sure the unstable nature of the old one is due to some dumb thing I did code I installed that’s running amok.
In the meanwhile I’m going to enjoy some nice stability and uptime for my site.
Note: The CC image above was a result of my typing “controlled implosion” into the WP Inject WordPress plugin. It’s a very cool plugin for finding CC images and I plan on leaving a review on WordPress.org sometime.
Featured image photo by Savannah River Site
Like this:
Like Loading...