simple client/server backup solution
I know Amanda and Bacula but was looking for something lighter and simple to backup 2 or 3. Vps to one server.
I would like to find a client/server solution to avoid passwordless solutions like rsync/rdiff/rsnapshoot.
Is there something like this in the open souce world?
Thanks
N.
6 Replies
#!/bin/sh
#[Note: This is a FULL system backup script and requires root. If you
# only want to backup your user files then tailor the script.]
# Use "sudo crontab -e" to set up a cron job to run it.
#
#[Note: --delete will remove target files and dirs that no longer exist in
# the source, you may or may not want this sync'ing.]
#
#[Note: The first backup will take a while, to add the files to the
# target, after that it should only take a matter of minutes.]
#
#[Note: rsync must be installed on the source and the target.]
#
BINPRE="rsync -r -t -p -o -g -v -l -D --delete"
SSH="-e ssh -p 22"
BINPOST="<target_user>@<target_host_ip>:/<target_backup_dir>"
EXCLUDES="--exclude=/mnt --exclude=/tmp --exclude=/proc --exclude=/dev "
EXCLUDES=$EXCLUDES"--exclude=/sys --exclude=/var/run --exclude=/srv "
EXCLUDES=$EXCLUDES"--exclude=/media "
date >> /root/start
$BINPRE "$SSH" / $EXCLUDES $BINPOST
date >> /root/stop</target_backup_dir></target_host_ip></target_user>
This cron entry will run it at 1 AM for you:
# m h dom mon dow command
0 1 * * * /root/bin/backup.sh > /root/backup.log 2>&1
Or if you feel like something more advanced you can use lvm snapshots but that requires fiddling with your partition setup.
@obs:
Note if you're running a database such as mysql you'll want to run mysqldump first or you may end up with a backup with an database in an inconsistent state.
Or if you feel like something more advanced you can use lvm snapshots but that requires fiddling with your partition setup.
Yep, I could have posted that, was in a hurry, here's my two cron lines minus the times, that do my MySQL and Postgres backups on a not to interfere basis with the rsync backup (I think I found that tr stuff for constructing a filename on these forums):
/usr/bin/mysqldump -u root -ppassword --all-databases | gzip > /root/databasebackups-mysql/database_"`date | tr \" \" \"-\"`".sql.gz
/usr/bin/pg_dumpall -h localhost -U postgres | gzip > /root/databasebackups-postgres/database_"`date | tr \" \" \"-\"`".sql.gz
FYI for the reader, you'll want to set up a .pgpass file.
We specifically wanted an incremental backup with 14 day retention
We have not actually tested this script as it is in this form, we have may servers and call this script from another script that passes server details as arguments, so I adapted this to assume its used for one server, so hope it works OK!
The general backup process works well for us, had done for a long time. We use it to backup to our office server, as a secondary backup solution in addittion to hosts backups.
I was looking for something more like Bacula (client/server) to avoid connections using ssh keys.
I don't know if this exists but was trying to find!
it can handle mysql consistently if you configure it without mysqldumps needing to be taken before backup and they way it backs up, you could run it hourly on reasonably busy systems without impact and it only transmits changed blocks
only other downside with linode VM's (and any other Xen PV hosts) is that you cant really do block level restore only file or db's which is slower