Site backup

DreamMachine

Extreme Ultra VIP
Aug 3, 2008
496
10
0
Australia
Anyone care to share their business/site backup strategy?

I have around 50 sites shared between 3 or 4 hosting providers and I don't really have a 'unified' backup strategy for them all. I'm thinking of either doing some sort of nightly extract of the database, plus downloading the files to my local raid5 (which is then backed up onto a second raid5 array) or signing up for a web service.

Most of the sites are wordpress. Is there any easy way to have nightly offsite backups along with an associated easy way to restore?
 


For your database, a shell script to do a DB dump nightly is the norm. I typically have it stored in a non-web accessible directory for a month, then those are auto deleted based on date. I don't typically do an off-site backup on affiliate sites because the only data I really care about is traffic analysis.

For anything you can't bear to lose, then you'd have another shell script run about 10 minutes or so after your DB dump that sends it to an another server via FTP.

As for a whole server backup of other files, the process would be the same, but most people would have their copies already on their personal computers if they're using GIT or FTP to upload to the server anyway (assuming you don't have auto-gen files created by users).

Just make sure you bzip compress the files after dumping the database or before sending via FTP.
 
There are backup plugins for WordPress that can save your DB, theme, and plugins and email you (or send via ftp to another location if the files get too large) zipped files for each of those. One is "WordPress DB Backup" and the other is "BTE WordPress Backup".
 
1. Dump all your DBs using MYSQLdump. Tar them up using Gzip option.
2. Tar up your home directory containing all your sites using Gzip option.
3. Store backup from 1 + 2 locally on secondary HDD. (I do this daily)
4. FTP / SFTP backups from 1 + 2 offsite to another server. (I do this weekly)

That would be for server one. You would then repeat the process for the other servers.
 
1. Dump all your DBs using MYSQLdump. Tar them up using Gzip option.
2. Tar up your home directory containing all your sites using Gzip option.
3. Store backup from 1 + 2 locally on secondary HDD. (I do this daily)
4. FTP / SFTP backups from 1 + 2 offsite to another server. (I do this weekly)

That would be for server one. You would then repeat the process for the other servers.

Ah!, I'm an idiot... Here I am thinking I'll have to install and configure a WP extension on each site when I can just do this for each server..

Nice one, thanks.
 
If you use Cpanel, why not just back up the cPanel?
Personally I use a back up plugin for individual sites as well, and I have set up all my servers to do a Cpanel back up every night.
 
If you use Cpanel, why not just back up the cPanel?
Personally I use a back up plugin for individual sites as well, and I have set up all my servers to do a Cpanel back up every night.

It is set on my main sites but it's still only backing up to the same physical disk. I want an automated off-site solution.
 
rsync is by far the best, assuming these are all VPS / dedicated servers you have root access to.

Have a small PHP script dump the mySQL databases every say 6 hours. Then have crontab run a rsync command at the same interval (set it for 10 mins after the mysql dumps). It'll create an exact replica of your server, or only the directories you want, and will only ever upload newly modified files (ie. your new SQL dumps). So your first transfer will be quite large, because it's going to upload everything, but from there on in, every 6 hour transfer is quite small because only modified files get uploaded.

Crontab or PHP to dump the mySQL databases, then rsync via crontab to copy over a replica to another server. Can't beat it.
 
It sounds like he's using mostly shared hosting... If that's the case, just dump the backups to a protected folder and then on your backup server have a nightly cron that grabs them with wget.

wget --user=yourname --password='yourpassword' hxxp://example.com/protected/backup.tar.gz
 
There are backup plugins for WordPress that can save your DB, theme, and plugins and email you (or send via ftp to another location if the files get too large) zipped files for each of those. One is "WordPress DB Backup" and the other is "BTE WordPress Backup".

^ I used "back up to dropbox" wp plugin.
 
Alot of good ideas already brought up (tar, gzip, git, rsync, scp, etc.), but one thing I would recommend doing that hasn't really been mentioned here, is periodically try to restore one of your backups. Nothing is worse than thinking you have daily backups, and then when you need them your backups are corrupt or incomplete.

Or, you may have specific PHP limits set by your provider, like memory usage, or set_time_limit to 60 secs. So seems like it's working great, until your database takes longer than 60 seconds to dump, or whatever the limits are.