Backup policy in BalticGrid
BalticGrid sites need a policy for running regular backup of the critical data. Those data include:
- site configuration data
- system logs for tracking any security issues
- accounting logs for tracking the site usage
Here we propose a solution that is aimed to help the site administrators to run and manage the data for backup.
Idea
There are two scripts:
- one for storing files in backup called grid-backup
- one for restoring files called grid-restore
in a config file you provide the list of files and directories that need to be backuped. In a command line parameter you provide the destination where to store the data and how long you wish to preserve that data.
For grid-restore
you provide the name of the file or directory you want to restore and destination where to put restored data.
The scripts are just wrappers to rdff-backup they are based on.
Installation:
- Download the scripts:
http://www.balticgrid.org/Grid_Operations/technicalguides/Files/grid-backup
http://www.balticgrid.org/Grid_Operations/technicalguides/Files/grid-restore - Make sure, that the files are executable:
#chmod u+x grid-backup grid-restore
- Install rdiff-backup tool
either manualy - see: http://rdiff-backup.nongnu.org/ (python installation is also required)
or:
#apt-get install rdiff-backup
if above command don't works you probably need to add apt repository:
#echo "rpm http://linuxsoft.cern.ch dag/redhat/el3/en/i386 dag" >> /etc/apt/sources.list.d/dag.list
#apt-get update
Configuration:
(Optional)
You may change location of config and logfile by manually editing first lines of grid-backup script. Default are: /etc/grid-backup /var/log/grid-backup
#grid-backup --create-config-file
Now EDIT (!)a config file and choose sections according to your needs.
eg. vi /etc/grid-backup
Usage:
There are two functionalities: backup and restore.
Backup script can also delete files older than given limit after backup.
#grid-backup DESTINATION [--delete-older-files|-d time]
eg.:
#grid-backup /backup -d 3M5D1h (remove older than 3 Months 5 Days 1 hour)
#grid-restore hostname.net::/remote
see: man rdiff-backup, form more time format information
grid-restore BACKUP_DIR/FILE[|DIR]_TO_RECOVER RECOVERED_FILE[DIR]_NAME [time(=now default)]
eg.:
#grid-restore /backup/var/log/messages ./messages 2M3D (restore file as it was 2 months and 3 days ago)
#grid-restore hostname.net::/remote/directory /etc/directory 2005-11-09T12:43:53
(
If you are absolutely sure, that you want to remove a target first, then restore a file, you may add a --force parameter at very end. (beware: hidden "rm -rf")
Crontab & do NOT forget
(about reading logfile)
#crontab -e
add a line like this for running backup daily:
4 1 * * * /root/grid-backup/grid-backup backup@secure-host.somewhere.net::/site_backup_dir
Note, that if you want to make remote backups in crontabs, you need to configure no-passwd ssh authentification. How to do it? See eg. (TODO link).
TODOs:
in text

