Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJen Brannstrom
Courses Plus Student 5,694 PointsServer to server storage migration
I have a hosting account at Dreamhost, but I want to move to either a Google Cloud Storage, or Amazon AWS cheaper storage.
It's a lot of files (over 70GB), I could use CyberDuck to FTP everything to my pc and then back up to the new hosting, but I believe the pro's (Treehouse) wouldn't do it that way at all. Can anyone provide me with a simple article on how to connect two servers to each other like this? In the last episodes of the command line tutorial Jim taught cp and mv, so I'm familiar with those.
Dreamhost requires I set up an SSH tunnel to connect via command-line (this means I have to somehow get my head around 'Pageant'.
Any tips are most appreciated!
5 Answers
James Barnett
39,199 PointsTL;DR SSH into Dreamhost and use something like this:
rsync -avz <path>/* <new server>:/<path>
How copy over a website
- Setup New Hosting Account
- Copy your files from Dreamhost to your new hosting account
- SSH into Dreamhost
- run rsync from local to remote
- wait a few hours
- Backup any Databases you have (such as MySQL)
- Setup Databases on new server and import backups
- Make sure everything is working on the new server
- Pay careful attention to absolute paths
- Firewall rules you may have had setup at dreamhost
- Form submissions
- Databases setup
- CMS systems like Joomla & Wordpress
How to cut over with minimal downtime
- Plan an outage window for 4 hours
- it should take less than 1, better safe than sorry
- Stop making changes to the site
- Put up a temporary maintenance redirect
- Copy over any recent data added to your databases
- Run rsync, to get any changes to your site since your backup
- Make sure everything is working perfectly
- Change the DNS
- Watch DNS replication with whatsmydns.net, test to make sure everything is now working
rsync fundamentals
- To learn about rsync in general check out
- Check out example 4, local to remote
Jen Brannstrom
Courses Plus Student 5,694 PointsThanks very much James for the full description! Luckily this is just a storage of images, word docs, PDF's etc. (71GB) No a CMS or any website needs move. If this succeeds then I might be brave enough to try moving my website! Will let you know how it works out :)
James Barnett
39,199 Points@Jen - If you are just moving some files, that's way less complex
This should be all you need:
rsync -avz <path>/* <new server>:/<path>
Jen Brannstrom
Courses Plus Student 5,694 PointsGreat stuff, James. What does the "-avz" mean?
James Barnett
39,199 PointsJen - In linux you can use switches to change how a command works.
ls -l
will show a detailed listing of files in a directory, the l
stands for long. You can also combine switches as I did here.
In the case of rsync -avz
, I couldn't remember, I just always used those switches, so I had to look it up on http://ss64.com/bash/rsync.html
-
a
= archive -
v
= verbose -
z
= compress
"archive" mode ensures that symbolic links, devices, attributes, permissions, ownerships etc are preserved in the transfer.
If you are ever curious what a switch for a Linux command does, your first stop should be ss64.com/bash.