6

I have a dedicated Ubuntu web server in a cloud environment, and I am looking for a nice way to do automated backups.

I would like to backup some directories with web apps, and all my MySql databases. As for destination: make snapshots every two hours localy, and every six hours to a remote ftp server. Also delete backup archives older than seven days(localy + ftp), and notify on any problems by email.

Now to achieve some of this functionality I use cron + shell script, and http://www.mysqldumper.net/, but really that doesn't answer my needs. Mysqldumper doesn't know automaticly about new databases, and shell script does not notify on problems. It's something I have to check out from time to time, and i don't have trust for.

I googled a while, and seems like most people solve this stuff with shell scripts. Is this a method you can trust? Are there any web-gui tools, I'm missing? Maybe there is a smarter startegy for doing this? I'm a little bit confused.

Luigi
  • 173
  • 5

6 Answers6

4

Actually I'm using rsnapshot for backup. It can't backup mysql db itself, but it allows to execute scripts before and after backup. So before rsnapshot executes:

 /usr/bin/ssh remote_host 'mysql -N -e "SHOW DATABASES;" | while read db; do mysqldump --skip-comments $db |gzip > ~/db/${db}.sql.gz; done'

all mysql settings are stored in ~/.my.cnf and after backup is done rsnapshot executes script to remove dump on remote host.

Also rsnapshot uses hardlinks, when it makes backup, so it saves your space and you have full backup for any moment it was done.

Rsnapshot uses rsync to transfer data, therefore it's more secure then ftp.

rush
  • 1,981
  • 2
  • 15
  • 23
  • My second server (used for backup) has only ftp access, and mysqldump sucks at large databases. – Luigi Apr 10 '12 at 18:15
4

We have a similar situation and we use automysqlbackup (instead of mysqldumper as in your case) and rsnapshot as well. Automysqlbackup can inform you as well by email.

Raffael Luthiger
  • 2,001
  • 2
  • 17
  • 26
  • I've reviewed the script 'automysqlbackup', but it seems that it doesn't play nice with large databases. I found info, that it uses regular mysql_dump, and so locks table while dumping. That's a problem for me, not just a scenario and one of the reasons i began using mysqldumper. – Luigi Apr 08 '12 at 19:52
2

You appear to have specific requirements for your backups: you know what to back up, what are the intervals you like to use, how you like delete old backups etc. I think it is very unlikely that you find a free gui-based application to do all these in a way you like and make it all an automated process.

The solution I suggest is to use command line tools to do the steps and then glue them all together with a scripting language like Perl or Python to make it a single cron-started process. You can catch subprocess return values in you script and take appropriate actions. You can do whatever logging you like and you can even add verify steps and a recovery test to your script. I would trust to this kind of solution more than to a gui-based application.

XDF
  • 86
  • 4
1

I used to use shell scripts for backups, but I gave up as they were ultimately unmaintainable. I use Bacula an Open Source network backup and restore solution. Once I got it running I never looked back. It should do all you need and more (I won't list all the features here as I'm sure there are better guides to be found with Google).

Bacula will email you backup reports on success or failure. You can set a complicated schedule for full and incremental backups. You can span you backups over multiple volumes on multiple storage media. The server and storage systems can each all be run on different machines separate from the clients.

Specifically you mentioned backing up databases. Bacula supports running client and sever-side scripts at various stages of the backup, so you can, for example, dump all you databases to a file before the backup begins.

Evan Sosenko
  • 111
  • 1
1

I use a combination of backupninja and duplicity for backups of my server. Backupninja has the ability to backup MySQL databases. Duplicity creates incremental backups (optionally encrypted) using an algorithm similar to rsync, and can transfer backups using a number of protocols (like SCP/SFTP, FTP, WebDAV, or storing in Amazon S3).

Daniel Lo Nigro
  • 464
  • 2
  • 6
  • 10
0

If you are in a cloud setup you should consider EC2. There is no better backup than one that you can bring up in minutes with a new instance. All you need is some regular snapshots and you will be set in case of failure.

devnull
  • 188
  • 1
  • 8