█ YagHost - Pure SSD Hosting | Since 2007 | Average Response Time: 15 min
█ Web Hosting | Reseller Hosting | Managed VPS Hosting
█ 99.9% Server Uptime Guarantee | 24/7 Rapid Response Tech Support | 30 Day Money Back Guarantee
█ LopHost.com - Web Hosting Tutorials
I'd just use Rysync to move copy your data between two virtual servers. It's easy and doesn't eat up a ton of resources. I've got two different machines with only 256MB of RAM that I backup every two hours. A MySQL DB is compressed and backed up, which is 150~mb, plus WWW data which is a couple hundred mb as well. Runs on a cron every two hours and works quite well.
# Remove the old local version #
rm -rf [backupdirectory]/www/*
rm -rf [backupdirectory]/sql/*
# Get the MySQL DB and back up locally #
mysqldump -h[MySQLHOST] -u[MySQL USER] -p[MySQL Password] [DBNAME] | gzip -9 > /[backupdirectory]/sql/[WebsiteNAME]_$(date +"%m_%d-%Y_%H:%M").sql.gz
# Get the WWW data and back that up locally #
tar -zcf /[backupdirectory]/[sitename]_backups_www_$(date +"%m_%d-%Y_%H:%M").tar.gz [path/to/www/data]
# Connect to and creates the required directories on remote machine #
ssh -p [sshport] -i '/root/.ssh/id_rsa' [user]@[remote-machine] mkdir -p /[path-to-remote-backups]/[site-name]/www/$date
ssh -p [sshport] -i '/root/.ssh/id_rsa' [user]@[remote-machine] mkdir -p /[path-to-remote-backups]/[site-name]/sql/$date
#Move that **** #
rsync -auvz -e "ssh -p [sshport] -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa" [path/to/local/www/backup]
rsync -auvz -e "ssh -p 4566 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa" [path/to/local/SQL/backup]
You can use something like that... sorry for the crude code, I had to replace my paths with fake ones. Just edit thigns as needed until you get it to work. You'll need to know a bit about SSH keys and setting a cron job.
So, I've got a remote server now with backup archives that look like this and goes for months:
This makes restoring a breeze, and I've got many copies of backups available.
I'm working on a user-friendly bash script to share, but it won't be ready anytime soon. It'll configure your backup setup, test it, and aid in the process of getting everything setup properly.
vpsBoard - An active resource for all things Virtual Private Servers. Tutorials, Guides, Offers and more!
Come join the conversation! 90,000 posts and growing daily! The fastest growing hosting forum around!
Further along the lines of rsync, there's duply which wraps duplicity. It allows for GPG encryption so your backups can be dumped pretty much anywhere safely. It has a pre-script that you can use to dump MySQL as well as a post-script.
It does full/incremental backup sets and can prune old chains to save space. If you're old school and expect backups to actually be archival quality (eg: stored securely offline on tape/dvd/hdd) then it fits the best I've seen so far.