rBackup

Presentation

rBackup is an alternative to the rsnapshot (http://www.rsnapshot.org/) backup program. The aim was to create an easy to use backup procedure using the rdiff-backup script - http://www.nongnu.org/rdiff-backup/ - (as rsnapshot is taking advantage of rsync - http://rsync.samba.org/). The beauty behind rdiff-backup is that it lets you retrieve and store only the differences within the files, avoiding to store useless redundant data. Hence the main goal of such a backup program is to save storage room over solutions merely using rsync.

Example:

Suppose you need to backup 1,000 MySQL databases, and that you use a program like mysqldump to dump each sql database into a database.sql file. Now suppose you have to make such a backup every day, that each database grow by 8 kilobytes a day and that each former database is 1 megabyte. With rsync (or rsnapshot), each time a change is made to the database dump file, it will have to store a new complete copy of the file. With rdiff-backup, you only store differences between files as they appear (and differences are actually compressed by gzip by default).

In 1 week, you would need 7.97 GB of storage if you were using rsync / rsnapshot against 1.03 GB if you were using rdiff-backup / rbackup !

In 3 months, you would need 119.42 GB of storage if you were using rsync / rsnapshot against 1.66 GB if you were using rdiff-backup / rbackup !

In 1 year, you would need 864.24 GB of storage if you were using rsync / rsnapshot against 3.76 GB if you were using rdiff-backup / rbackup !

Usage

Configuration file /etc/rbackup.conf


# Root of the dir where backups will be stored
##
rbackup_root /tmp/


# Basic backups of directories. Could be remote or local, check out the
# usage of rdiff-backup.
#
# backup [source directory] [destination directory]
#
# The content of the variable rbackup_root is appended to the destination
# directory.
#
##
backup toad@ns1.lescigales.org::/epsylon/toad ns1/toad
backup toad@ns1.lescigales.org::/epsylon/test ns1/test


# Backup helped by a script.
#
# Like in the design of rsnapshot, a temporary directory will be created,
# rbackup will chdir() to it, will run the script specified in the config,
# then simply call rdiff-backup against this temporary directory and the
# destination
#
# Syntax: script [script path] [destination]
#
# The script path is actually a list of comma separated items that are joined
# together to become the script + parameters list
#
# Example: script /usr/bin/rbackup_mysql,-d,database,-h,user@hostname sql/db/
#
##
script /usr/bin/rbackup_mysql,-d,toad,-h,toad@lescigales.org sql/toad/


# Subversion replication settings
# Here rdiff-backup is not used, I just added it for my backup purposes
#
# Syntax: svnsync [source] [destination]
#
##
svnsync svn+ssh://lescigales.org/lescigales ns1/svn/lescigales


# Class definition
# When you define a class, you can then backup only items contained in that
# class using 'rbackup -t className'
#
# Syntax:
# class websites
# backup username@hostname::/websites/user1 hostname/websites/user1
# backup username@hostname::/websites/user2 hostname/websites/user2
#
# By default, when no class is defined, the class name is set to 'default'
#
##
class websites

# Variables substitution
#
# Syntax: var [name] [value]
#
##
var mysql /usr/bin/rbackup_mysql.php

script $mysql,-d,toad ns1/sql/toad

Real world configuration file example here.

Command line usage

# Backing up everything in the 'system' class using the configuration file ./rbackup.conf
$ rbackup -t system -c ./rbackup.conf

Crontab jobs

# Example of crontab jobs:
# Hourly backups:
0 * * * * /usr/bin/rbackup -t repositories
0 * * * * /usr/bin/rbackup -t system_db
0 * * * * /usr/bin/rbackup -t system
0 * * * * /usr/bin/rbackup -t laptop
# Every 4 hours:
0 */4 * * * /usr/bin/rbackup -t home
0 */4 * * * /usr/bin/rbackup -t customers_db
0 */4 * * * /usr/bin/rbackup -t customers
# Twice a day:
0 */12 * * * /usr/bin/rbackup -t free_db
0 */12 * * * /usr/bin/rbackup -t free

Quick install of rdiff-backup under Ubuntu

# aptitude install python2.4-dev librsync-dev
# wget http://savannah.nongnu.org/download/rdiff-backup/rdiff-backup-1.1.12.tar.gz
# tar xzvf ./rdiff-backup-1.1.12.tar.gz
# cd ./rdiff-backup-1.1.12
# python setup.py install

Requirements

Downloads

Changelog

rBackup 0.5 - 4 Sept 2007

rBackup 0.4 - 20 July 2007

Authors

Hosted by: Hebergement gratuit sans publicite