Koozali.org formerly Contribs.org

[ANNOUNCEMENT] Turn SME7 into a dedicated backup server

Offline m

  • *
  • 276
  • Michael
[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« on: April 05, 2007, 09:13:24 PM »

Please see http://wiki.contribs.org/Affa for full documentation.


Hi all,

for some time I use dedicated backup servers with huge RAID disks to backup all my SME server installations. I ran the rsnapshot programm and a few additional shell scripts to make it meet my requirements. Although it has been working well, there were some unsatisfactory points. I decided to redo it from the scratch as a standalone perl program without rsnapshot. My goal was to make a tool, which run reliable and unattended once it was setup.

The program itself is completed now. Documenation needs to be done and will be done soon. For those who are interested in now and don‘t want to wait for the docs, I have written a feature list and a tiny howto, which should be enough for a first try.

Affa features:
* 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 and configuration mini-howto

Sample:
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‘, download the packages from http://mirror.contribs.org/smeserver/contribs/michaelw/sme7/affa/ and install them

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
Code: [Select]
my $jobname=‘prodbox‘;
and
Code: [Select]
'remoteHostName‘=>‘10.200.48.1‘,
This script is to ease the configuration. You could also do the config it using the ‚db affa‘ command.

5) run the config script
# /root/prodbox-job.pl

6) installing the cron job
# affa --make-cronjobs

7) run the job manually (or wait until 10:30 pm)
# affa --backup prodbox

8) view the log
# tail -f /var/log/affa

9) View the status
# affa --status

10) View the report
# affa --report

11) View the backup archive
cd /var/affa/prodbox/schedule.0/

duncan

[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« Reply #1 on: April 06, 2007, 05:56:36 AM »
Sounds interesting - is this SME only or can the backup end be run on any version of Linux.

Offline m

  • *
  • 276
  • Michael
[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« Reply #2 on: April 06, 2007, 10:30:01 AM »
Quote from: "duncan"
is this SME only or can the backup end be run on any version of Linux.


SME 7 only.
# rpm -q --requires smeserver-affa
perl-Filesys-DiskSpace  
smeserver-release >= 7

but you can backup data from any other type of OS, which has sshd and  rsync installed and supports DSA key login.

Offline timb

Tried this - seems to work very well! - some questions
« Reply #3 on: April 09, 2007, 06:06:18 AM »
Hi,
Tested this out last night using some vmware images. Very easy - and tried a 'rise' and it worked quite well

Looking forward to documentation

Offline timb

rpms no longer available?
« Reply #4 on: April 10, 2007, 08:58:31 AM »
They were there yesterday - cant seem to see them today.

Offline Jean-Philippe Pialasse

  • *
  • 1,490
  • aka Unnilennium
    • http://smeserver.pialasse.com
[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« Reply #5 on: April 10, 2007, 12:02:59 PM »
no more one the mirors , i would enjoy to test this !!

Offline m

  • *
  • 276
  • Michael
[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« Reply #6 on: April 10, 2007, 01:54:32 PM »
Quote from: "unnilennium"
no more one the mirors , i would enjoy to test this !!


Appears to be a problem on distro.ibiblio.org server. Please use my mirror:

http://neddix.com/sme7/affa/

or the Planet Mirror Server
http://mirror.contribs.org/smeserver/contribs/michaelw/sme7/affa/

Offline m

  • *
  • 276
  • Michael
[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« Reply #7 on: April 13, 2007, 11:11:31 PM »
I have started the documentation on http://wiki.contribs.org/Affa

[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« Reply #8 on: April 14, 2007, 11:30:32 AM »
wow, this looks very interesting, it sounds like exactly what I need. As soon as I get some time I'm going to try this out

Offline sages

[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« Reply #9 on: April 30, 2007, 10:57:23 AM »
my trial system setup is using sme 7.1.3 as the affa server and a sme 6.01 as the client.
i've noticed that you appear to need to allow root logon via ssh on the client for the send key and backup functions to work.
doing a trial backup reports:
Quote
" Error: rsync failed with status 12."


i'm guessing that there is some descrepency between rsync on the older sme and the current sme.
but i'm not certain.

and the hourly watchdog reports the following:
Quote
Can't locate Date/Format.pm in @INC (@INC contains: /usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.6.1/i386-linux /usr/lib/perl5/vendor_perl/5.6.1 /usr/lib/perl5/vendor_perl) at /etc/cron.hourly/affa-watchdog-fwbox-xxxxx line 30.
BEGIN failed--compilation aborted at /etc/cron.hourly/affa-watchdog-fwbox-xxxx line 30.

which i'm also guessing means that there is a perl module not present.

the sme 7.1.3 system is a new install ( have run yum update on it ) with affa and smeserver7 admin installed on it.

can you please advise what the test system is that you are using? ie versions of sme running on client and server.
And if you have seen the perl module issue mentioned above.

i'll continue to poke and prod  :wink:
[edit] duh, perl module is an issue on the client sme  :oops:

[edit # 2] sigh  :oops:  :oops: now that i've RTFM  :oops: and seen the note about sme 6 i'll try again.
...

Offline m

  • *
  • 276
  • Michael
[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« Reply #10 on: April 30, 2007, 11:32:38 AM »
Quote
" Error: rsync failed with status 12."


Did you set the 'rsync--inplace' property to 'no'?


Quote

which i'm also guessing means that there is a perl module not present.

The watchdog script needs the perl-TimeDate package, which is installed by default on SME7 but not on SME6. Please downlaod and install http://dag.wieers.com/rpm/packages/perl-TimeDate/perl-TimeDate-1.16-0.rh73.dag.noarch.rpm on your SME6 box.

Quote

can you please advise what the test system is that you are using? ie versions of sme running on client and server.
And if you have seen the perl module issue mentioned above.


I run affa on SME7.1x and backup SME7.1.x and a few SME6 servers. I didn't notice the SME6 Date::Format issue yet

Offline sages

[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« Reply #11 on: April 30, 2007, 11:44:14 AM »
Quote
Did you set the 'rsync--inplace' property to 'no'?

after reading the nice wiki manual you made  :oops: i have done so now. a trial backup is running as I write this and so far appears to be running ok.

i'll try the perl module you suggested as soon as it is finished.

many thanks
...

Offline sages

[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« Reply #12 on: April 30, 2007, 01:05:40 PM »
backup appeared to complete ok.

after loading the perl module on the sme6 box i'm now getting the following report
Quote
Constant name 'HASH(0x83559f0)' has invalid characters at /etc/cron.hourly/affa-watchdog-fwbox-xxxxxxxx line 34
BEGIN failed--compilation aborted at /etc/cron.hourly/affa-watchdog-fwbox-xxxxxxxx line 34.
...

Offline m

  • *
  • 276
  • Michael
[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« Reply #13 on: April 30, 2007, 05:03:55 PM »
Quote from: "sages"

after loading the perl module on the sme6 box i'm now getting the following report
Quote
Constant name 'HASH(0x83559f0)' has invalid characters at /etc/cron.hourly/affa-watchdog-fwbox-xxxxxxxx line 34
BEGIN failed--compilation aborted at /etc/cron.hourly/affa-watchdog-fwbox-xxxxxxxx line 34.


The perl syntax was not compatible with perl 5.6 on SME 6. I have fixed this in affa version 0.1.3, which is on the way to the mirrors.
Thanks for the report.

Offline sages

[ANNOUNCEMENT] Turn SME7 into a dedicated backup server
« Reply #14 on: May 01, 2007, 05:01:41 PM »
thanks michael.
it looks like the update has resolved the outstanding issues i had found.
...