Difference between revisions of "Affa"

From SME Server
Jump to navigationJump to search
m (Removing all content from page)
Line 1: Line 1:
== Affa - Automated Remote Disk Archiver ==
 
--- '''UNDER CONSTRUCTION''' ---  '''UNDER CONSTRUCTION'''  ---- '''UNDER CONSTRUCTION''' ---
 
=== Maintainer ===
 
Michael Weinberger
 
  
Affa was contributed on [http://forums.contribs.org/index.php?topic=36499.0 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
 
[http://mirror.contribs.org/smeserver/contribs/michaelw/sme7/affa/ ibiblio]
 
or
 
[http://mirror.contribs.org/smeserver/contribs/michaelw/sme7/affa/ PlanetMirror].
 
<br>
 
Download the ''perl-Filesys-DiskSpace'' package from [http://dag.wieers.com/rpm/packages/perl-Filesys-DiskSpace/ DAG] or from one of the mirrors above.
 
<br>
 
Install the RPMs.
 
 
==== Quick start example ====
 
You have a SME 7 production server with hostname 'prodbox‘ and IP 10.200.48.1.<br>
 
Set up a second SME 7 box as your backupserver with hostname 'affabox‘ and IP 10.200.48.2.
 
 
# log into the 'affabox' and install the packages as described above.
 
# generate the DSA keys and send the public key to the 'prodbox'<br><code># affa --send-keys 10.200.48.1 </code>
 
# copy the config helper script sample<br><code># cp /usr/lib/affa/jobconfig-sample.pl /root/prodbox-job.pl </code>
 
# edit /root/prodbox-job.pl and set<br><code>my $jobname='prodbox';</code><br>and<br><code>'remoteHostName‘=>'10.200.48.1',</code>
 
# write the configuration<br><code># /root/prodbox-job.pl</code>
 
# run the job manually<br><code># affa --backup prodbox</code>
 
 
=== 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'.<br>To setup a new job enter:
 
<br><code># db affa set myprodsrv job</code><br>
 
then set the properties<br>
 
<code># db affa setprop myprodsrv remoteHostName 192.168.1.1</code><br>
 
<code># db affa setprop myprodsrv TimeSchedule '0030,0730,1130,1330,1730,2030'</code><br>
 
<code># db affa setprop myprodsrv Description 'My Production Server'</code><br>
 
<code># db affa setprop myprodsrv status enable</code><br>
 
and so on...
 
 
Alternatively you can you use a script as described above in the 'Quick start' chapter.
 
 
To verify your work, type:<br>
 
<code># db affa show myprodsrv</code>
 
 
==== Affa configuration properties ====
 
{| border="1" cellpadding="3"
 
|-
 
| '''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<br>dailyKeep<br>weeklyKeep<br>monthlyKeep<br>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]<br>Include[1]<br>...
 
| full path || additional files or directories to include
 
|-
 
| Exclude[0]<br>Exclude[1]<br>...
 
| 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<br>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 ===
 
==== Standard ====
 
Dedicated Affa server to backup all production servers<br>...
 
 
==== Local Affa server plus a Affa server in remote location ====
 
# Standard setup<br>...
 
# Chained setup<br>...
 
 
==== Two production servers backup each other ====
 
...
 
==== Move SME 7 server to a new hardware using Affa with rise feature ====
 
...
 
==== SOHO - Use Affa to backup to a local attached USB drive ====
 
...
 
 
=== Restore ===
 
# Restore single files<br>....
 
# Full restore<br>...
 
=== Files ===
 
...
 
 
=== Additional information ===
 
...
 
 
 
=== Acronym ===
 
Affa stands for '''A'''utomatische '''F'''estplatten '''F'''ern'''a'''rchivierung
 
[[Category: Contrib]]
 
----
 

Revision as of 22:56, 13 April 2007