Affa

From SME Server
Jump to navigationJump to search

Affa - Automated Remote Disk Archiver

UNDER CONSTRUCTION

Maintainer

Michael Weinberger

Affa was contributed on Thu Apr 05, 2007

Description

The main purpose of this affa package is to turn a SME 7 Server into a dedicated backup box in a few minutes. Affa backups as many as you like SME servers or any other servers which have sshd running and rsync installed. Once it was configured, Affa runs reliable and unattended and send warning message in case of an error.

All backup archive are full backups. As Affa make use of the hardlink technique. Therefore a new full backup only needs disk space for the differences plus the filesystem overhead for the hardlinks and directories (which is typically 2-3%).

Affa is based on the rsync program and supports the rsync --compress option. This allows you to run backups over the internet or VPN. A typical setup is one or more Affa backup servers placed in different locations, which backup the production server(s) over the VPN.

A special feature is the rise option, which allows you to rise the backup server to your production server from a backup archive in case of a dead loss of your production server. The rise is executed within a extremly short time, even with huge ammount of data. The rise feature uses hardlinks and therefore does not use up additional disk space.

Affa features at a glance

  • Makes full backups with every scheduled run
  • Keeps configurable number of scheduled, daily, weekly, monthly and yearly full backup archives
  • Using rsync with optional compression for low traffic allows backups over the internet/VPN
  • Uses hardlink technique, i.e. physical disk space only needed for the differences between two full backups
  • Backup jobs are started by crond
  • Backups the default e-smith directories/files with property SMEServer set to yes
  • Additional directories/files can be included
  • Directories/files can be excluded from the backup
  • Non-SME server linuxes can be backuped by setting SMEServer property to no and using a include list
  • Configurable nice level for rsync processes on backup and source server
  • Optional run of custom programs before and after a job run (e.g. running tape backup)
  • Checks the disk space left after a job run with warning levels strict, normal or risky
  • Extensive checking of failure conditions
  • Sends failure messages to a configurable list of email addresses
  • Sends warning message, if the backup server run out of disk space
  • Installs an optional watchdog on the source server for the case the backupserver fails
  • Watchdog sends warning, if an expected backup did not run
  • Watchdog sends a daily reminder message, if the error continues unchecked
  • Option to display current status of all jobs showing times of last and next run
  • Option to display reports of all stored backups shown size, tranferred volume, disk usage and more
  • Report can be sent to the configured email addresses
  • Option to send the public DSA key to the source server
  • Option to rise the backup server to a production server from a backup. For SME only
  • The rise option does not physically move data and therefore is extremly fast and needs no disk space
  • Rise option can be run remotely as the ethernet drivers of the backup server are preserved
  • Compares installed RPMs on source with backup server. Sends warning message, if not in sync
  • Undo rise option to restore the backup server
  • Configurable via a e-smith style db, with one record for each job and a default record for all jobs
  • Logs in /var/log/affa with optional debug switch for high verbosity
  • Log files are rotated weekly, with 5 logs kept

Installation

Download the smeserver-affa package from ibiblio or PlanetMirror.
Download the perl-Filesys-DiskSpace package from DAG or from one of the mirrors above.
Install the RPMs.

Quick start example

You have a SME 7 production server with hostname 'prodbox‘ and IP 10.200.48.1.
Set up a second SME 7 box as your backupserver with hostname 'affabox‘ and IP 10.200.48.2.

  1. log into the 'affabox' and install the packages as described above.
  2. generate the DSA keys and send the public key to the 'prodbox'
    # affa --send-keys 10.200.48.1
  3. copy the config helper script sample
    # cp /usr/lib/affa/jobconfig-sample.pl /root/prodbox-job.pl
  4. edit /root/prodbox-job.pl and set
    my $jobname='prodbox';
    and
    'remoteHostName‘=>'10.200.48.1',
  5. write the configuration
    # /root/prodbox-job.pl
  6. run the job manually
    # affa --backup prodbox

Configuration

The configuration is stored in an e-smith style database. Use the db command to configure Affa. The jobname is the record key with the type 'job'.
To setup a new job enter:
# db affa set myprodsrv job
then set the properties
# db affa setprop myprodsrv remoteHostName 192.168.1.1
# db affa setprop myprodsrv TimeSchedule '0030,0730,1130,1330,1730,2030'
# db affa setprop myprodsrv Description 'My Production Server'
# db affa setprop myprodsrv status enable
and so on...

Alternatively you can you use a script as described above in the 'Quick start' chapter.

To verify your work, type:
# db affa show myprodsrv

Affa configuration properties

Property Value Description
remoteHostName FQHN or IP of the source host
TimeSchedule HHMM,HHMM,... doesn't need to be ordered. At least one time is mandatory
Description text string
scheduledKeep
dailyKeep
weeklyKeep
monthlyKeep
yearlyKeep
integer >= 1 how many of the scheduled, daily, weekly, monthly or yearly backups should be kept
SMEServer yes or no when set to yes the default e-smith directories are automatically included and the properties RPMCheck and Watchdog can be used
Include[0]
Include[1]
...
full path additional files or directories to include
Exclude[0]
Exclude[1]
...
full path additional files or directories exclude from backup
RPMCheck yes or no compares the packages installation of the source host with this affa backup host. Sends a message with diff list if not in sync. This check is usefull, if you want have the option to rise the backup server to a production server from a backup.
DiskSpaceWarn strict or normal or risky or none run a disk space check after a job has been completed. With level 'strict' a warning message will be sent, if the available space is less then the size of the just completed backup. With level 'normal'/'risky' the message is sent, if less than 50%/10% of the backup size is still available.
localNice -19...+19 run rsync local process niced.
remoteNice -19...+19 run rsync process on source niced.
Watchdog yes or no when a job is started, affa installs a watchdog script on the source in /etc/cron.d/, which sends a warning message, if the next scheduled job (taken from the TimeSchedule property + 10 minutes) did not run. This guarantees, that you will be notfied even in case of a affa server outage. The watchdog script send a daily reminder message, if the error continues. The next run job replaces the watchdog script with a new trigger time.
ConnectionCheckTimeout seconds before the rsync is started on the remote source host, affa check the ssh conncetion and exits with an error after the configured time, if the host does not response.
rsyncTimeout seconds Rsync exits, if no data is transferred for the configured time. This avoids infinitely hanging in case of a network error.
rsyncCompress yes or no compress the tranferred data. May be useful with slow internet connections. Needs addtional CPU resources on source and backup host.
EmailAddresses name@domain.com,name@domain.com,... comma separated list of mail addresses where the messages should be sent to
preJobCommand
postJobCommand
full path programs (local on the affa server) to be executed before/after a job run. The jobname and type (scheduled, daily etc.) are passed as arguments to the program. The exit code is additionally passed to the post job command program. See /usr/lib/affa/ for sample perl scripts.
RootDir full path where to store the backup archives, Do not use /home/e-smith or /root as these are included in the backup and therefore the rise otpion will not work! Recommended: /var/affa
Debug yes or no set to yes to increase log verbosity
status enabled or disabled with set to disabled, no cron entries will made. You can still run a job manually.
rsync--inplace yes or no set to no, if the rsync versionon the source does not support this option (like rsync on SME6)

Example setups

Additional information