Koozali.org: home of the SME Server

Obsolete Releases => SME 7.x Contribs => Topic started by: m on April 05, 2007, 09:13:24 PM

Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on April 05, 2007, 09:13:24 PM

Please see http://wiki.contribs.org/Affa (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/
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: duncan 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.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m 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.
Title: Tried this - seems to work very well! - some questions
Post by: timb 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
Title: rpms no longer available?
Post by: timb on April 10, 2007, 08:58:31 AM
They were there yesterday - cant seem to see them today.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: Jean-Philippe Pialasse on April 10, 2007, 12:02:59 PM
no more one the mirors , i would enjoy to test this !!
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m 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/
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on April 13, 2007, 11:11:31 PM
I have started the documentation on http://wiki.contribs.org/Affa
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: misnerspace 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
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: sages 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.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m 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
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: sages 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
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: sages 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.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m 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.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: sages on May 01, 2007, 05:01:41 PM
thanks michael.
it looks like the update has resolved the outstanding issues i had found.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: edb on May 02, 2007, 05:19:36 AM
Can I ask why you wouldn't use BackupPC for this instead of recreating the wheel?

Nice work though!
Title: Think I found a bug
Post by: timb on May 03, 2007, 03:32:00 AM
Hi,
Little background - have a nice new server - experimenting with affa on it before it goes into production - burn in if you like.

Running affa - filled the 1.5T of disk space over a couple of backups.... oops Backing up 900G of data btw.

Blew away the /var/affa/machine dir

yum removed affa
yum installed the latest 1.3 version

re ran the machine.pl I created but this time cut all the keeps to 1
start backup (which is doing something - a backup can be seen in /var/affa/machine/scheduled.0)

decide to monitor
affa --status
Use of uninitialized value in pattern match (m//) at /sbin/e-smith/affa line 1360.
Use of uninitialized value in subtraction (-) at /sbin/e-smith/affa line 1361.
Use of uninitialized value in integer ge (>=) at /usr/lib/perl5/5.8.5/Time/Local.pm line 98.
Use of uninitialized value in integer lt (<) at /usr/lib/perl5/5.8.5/Time/Local.pm line 98.
Use of uninitialized value in integer ge (>=) at /usr/lib/perl5/5.8.5/Time/Local.pm line 98.
Use of uninitialized value in integer gt (>) at /usr/lib/perl5/5.8.5/Time/Local.pm line 102.
Month '-1' out of range 0..11 at /sbin/e-smith/affa line 1361

If you need any other files etc pls contact me

BTW this looks like a brilliant tool - cant see how backupc or whatever could even begin to be considered a replacement or option for affa's functionality.

Great job! - No - briliant!

 :oops:
Title: Re: Think I found a bug
Post by: m on May 03, 2007, 09:46:37 PM
Quote from: "timb"


Running affa - filled the 1.5T of disk space over a couple of backups.... oops Backing up 900G of data btw.


Version <=0.0.8 allowed to set scheduledKeep=1. With this setting affa has nothing to hardlink against and every run creates a physically full backup. As of version 0.1.1 scheduledKeep must be >= 2. Affa forces it to 2 ,if it was set to a lower value.

Quote from: "timb"

re ran the machine.pl I created but this time cut all the keeps to 1
start backup (which is doing something - a backup can be seen in /var/affa/machine/scheduled.0)


As said above, you should see a scheduled.0 and scheduled.1 after two runs.

Quote from: "timb"

decide to monitor
affa --status
Use of uninitialized value in pattern match (m//) at /sbin/e-smith/affa line 1360.
Use of uninitialized value in subtraction (-) at /sbin/e-smith/affa line 1361.
Use of uninitialized value in integer ge (>=) at /usr/lib/perl5/5.8.5/Time/Local.pm line 98.
Use of uninitialized value in integer lt (<) at /usr/lib/perl5/5.8.5/Time/Local.pm line 98.
Use of uninitialized value in integer ge (>=) at /usr/lib/perl5/5.8.5/Time/Local.pm line 98.
Use of uninitialized value in integer gt (>) at /usr/lib/perl5/5.8.5/Time/Local.pm line 102.
Month '-1' out of range 0..11 at /sbin/e-smith/affa line 1361

If you need any other files etc pls contact me


Would you please send me the file /home/e-smith/db/affa, the directory /home/e-smith/db/affa-report/ and the output of 'ls -l /var/affa/machine/' to mweinber (at) neddix.de.
Thanks.

PS:  Please be aware of major release number of zero. Although the concept is proven and the implemention has been already sucessfully tested in many production  environments, the affa release is still not final and may have bugs.
Title: Re: Think I found a bug
Post by: m on May 08, 2007, 01:19:44 PM
Quote from: "timb"

Use of uninitialized value in pattern match (m//) at /sbin/e-smith/affa line 1360.


Very early versions has used a different date format in the report files, which is not comaptible with the date format use now. It's no longer an issue with current version.

Version 0.1.4 is available. Among other improvements the --full-restore option ist now implemented. See the wiki for an example: http://wiki.contribs.org/Affa#Full_restore
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: soprom on May 09, 2007, 02:33:24 AM
This seems to be a great contribs!
I like it better than the so complicated backupPC.

Do you plan to have it controled from the server-manager!?
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: gerd on May 09, 2007, 05:12:24 PM
Soprom,

I must confess I am a Linux novice and I have the same opinion as you.

But as a "Linux novice" I didn't dare to ask for a sme-server control....but this would be an ideal solution for newbies like me.

regards

gerd
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: gerd on May 09, 2007, 06:56:11 PM
...just finished the 1st affa trial run - seems to work perfectly

regards

gerd
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 09, 2007, 09:39:04 PM
Quote from: "soprom"

Do you plan to have it controled from the server-manager!?

Short answer: No. It was a very early decision to design Affa as a command line tool.
I need a fast and lean tool, which can be used efficiently on the console or over a slow modem line.
A GUI is far to much trouble (for me), to say nothing of the expense to develop it.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: mmccarn on May 13, 2007, 03:30:41 PM
I have successfully configured AFFA to backup a windows workstation using cygwin with openssh & rsync installed.

On a "test" system on my local network, all is fine.

When backing up a remote system, I get an rsync error 12.  The remote system has several large (up to 6GB) files, and the folder I'm backing up contains some .lnk files

1) Do you already know what my problem is? (be nice!)

or

2) Is there an easy way to figure out exactly what rsync command AFFA is using so I could run it manually &/or play with the various options to try to figure out what's not working? (As I worked on this I kept wishing that the affa log contained the exact rsync command...)

As I post this I have just increased the rsyncTimeout to 3600; I don't know if this will help or not.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 14, 2007, 08:19:58 AM
Quote from: "mmccarn"

2) Is there an easy way to figure out exactly what rsync command AFFA is using so I could run it manually &/or play with the various options to try to figure out what's not working? (As I worked on this I kept wishing that the affa log contained the exact rsync command...)


with property 'Debug' set to 'yes', Affa logs the exact rsync command and the warning messages of rsync.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: Brenno on May 15, 2007, 09:17:53 PM
Wow... this installed really well on both machines (backup = SME 7.0, source = SME 6.0) and, when finally configured correctly via instructions at the excellent wiki, worked just as expected!!

For stats, I moved 7.4GB in 134,790 files over a 100M network in 35m08s from a 2xP4 1gHz, 1GB RAM to a 1xP4 2.4gHz 256MB RAM.

The only issue I (think) I have is that I didn't get an email report when the job completed.  I used the "affa --mailtest job" and received the test, though, and was getting email error reports before I corrected the config.

Other than that, this is a seriously effective contrib.  Very nice work.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 15, 2007, 10:13:46 PM
Quote from: "Brenno"

For stats, I moved 7.4GB in 134,790 files over a 100M network in 35m08s from a 2xP4 1gHz, 1GB RAM to a 1xP4 2.4gHz 256MB RAM.

Thanks. Added it to http://wiki.contribs.org/Affa#Performance

Quote from: "Brenno"

The only issue I (think) I have is that I didn't get an email report when the job completed.  I used the "affa --mailtest job" and received the test, though, and was getting email error reports before I corrected the config.

Affa never sends messages on success, only on failures. Think of 20 configured jobs, you would be flooded with success messages.

Quote from: "Brenno"

Other than that, this is a seriously effective contrib.  Very nice work.

Many  thanks. I'm pleased, that you find it useful.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: Brenno on May 15, 2007, 10:21:16 PM
You have the source/destination specs reversed in the wiki : )  The source was the SME6.0 box and I did not use compression.

Understand re: the success message.  I'm so used to getting automated success messages that it seemed conspicuously absent!
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 15, 2007, 10:30:37 PM
Quote from: "Brenno"
You have the source/destination specs reversed in the wiki : )  The source was the SME6.0 box and I did not use compression.

Oopsala. Fixed.

Quote from: "Brenno"

Understand re: the success message.  I'm so used to getting automated success messages that it seemed conspicuously absent!

I added a note to the wiki doc.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: Brenno on May 16, 2007, 03:16:00 PM
Michael,

Now that this has had a chance to run on it's own overnight, I've discovered some issues, probably minor, probably my fault:

1.) I have two jobs configured, "prodbox" and "myprodsrv".  I think this is because I followed both the Quick Start Example and the Configuration sections in the wiki, which apparently results in building two separate jobs!  How do I safely remove one of those jobs?

2.) I received a notice mail from the source server saying "serviceControl: Couldn't system(/etc/rc.d/rc7.d/S85httpd-e-smith, restart):
Couldn't restart httpd-e-smith at /etc/e-smith/events/actions/restart-httpd-full line 45." and now I can't get into the server-manager.  Is this coincidental?

I can post logs or file contents if this is helpful to you.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 16, 2007, 04:06:09 PM
Quote from: "Brenno"


1.) I have two jobs configured, "prodbox" and "myprodsrv".  I think this is because I followed both the Quick Start Example and the Configuration sections in the wiki, which apparently results in building two separate jobs!  How do I safely remove one of those jobs?


You are right, using different job names  in the examples is confusing. I have fixed that.
To delete a job run:
Code: [Select]
# affa --delete-job JOB
(see: http://wiki.contribs.org/Affa#Usage_and_command_line_options)

Quote from: "Brenno"

2.) I received a notice mail from the source server saying "serviceControl: Couldn't system(/etc/rc.d/rc7.d/S85httpd-e-smith, restart):
Couldn't restart httpd-e-smith at /etc/e-smith/events/actions/restart-httpd-full line 45." and now I can't get into the server-manager.  Is this coincidental?


I don't think, that this was caused by Affa. Affa does not start/stop httpd services on the source.
Your source server is a SME6 and on SME6 the httpd-admin often crashes. Try (if needed serveral times)
Code: [Select]
# /etc/rc.d/init.d/httpd-admin restart
# /etc/rc.d/init.d/httpd-e-smith restart
Title: keys sent successfully to prod box, but affa can't connect
Post by: markseymour on May 17, 2007, 03:21:03 AM
Michael,

Any ideas on this?  (I assume it really has nothing to do with Affa, but with ssh config)

Thanks,

Mark
------------------------------------------
snips from /var/log/affa:

Wed May 16 20:28:13[START.4459]: Running /sbin/e-smith/affa --send-keys --job=mail3prod
Wed May 16 20:28:13[send keys.4459]: Generating DSA keys...
Wed May 16 20:28:18[send keys.4459]: Successfully created DSA key pair.
Wed May 16 20:28:26[send keys.4459]: DSA keys sent to 192.168.111.1
Wed May 16 20:28:26[send keys.4459]: Done.

Wed May 16 21:05:37[mail3prod.4511]: Starting job (192.168.111.1,scheduled)
Wed May 16 21:05:37[mail3prod.4511]: Description: Primary mailserver backup
Wed May 16 21:05:37[mail3prod.4511]: Shifting backup archives...
Wed May 16 21:05:37[mail3prod.4511]: Nothing to be done.
Wed May 16 21:05:37[mail3prod.4511]: Checking connection to 192.168.111.1
Wed May 16 21:05:37[mail3prod.4511]: Exec Cmd: /usr/bin/ssh -p 22 -o ConnectTime
out=120 -o PasswordAuthentication=no -q 192.168.111.1 true
Wed May 16 21:05:37[mail3prod.4511]: Exec Out: exitstatus=255
Wed May 16 21:05:37[mail3prod.4511]: Error: No response from host 192.168.111.1.
 Did you send the public key?

-------------------------------------------------

[root@sme2 ~]# db affa show mail3prod
mail3prod=job
    ConnectionCheckTimeout=120
    Debug=yes
    Description=Primary mailserver backup
    DiskSpaceWarn=strict
    EmailAddresses=admin,admin@192.168.111.1
    Include[0]=/opt/roundcube/config/main.inc.php
    Include[1]=/opt/roundcube/config/db.inc.php
    RPMCheck=yes
    RootDir=/var/affa
    SMEServer=yes
    TimeSchedule=0030,0730,1130,1330,1730,2030
    Watchdog=yes
    dailyKeep=7
    doneDaily=2007136
    doneMonthly=200705
    doneWeekly=200719
    doneYearly=2007
    localNice=0
    monthlyKeep=12
    remoteHostName=192.168.111.1
    remoteNice=0
    rsync--inplace=yes
    rsyncCompress=yes
    rsyncTimeout=900
    scheduledKeep=2
    status=enabled
    weeklyKeep=4
    yearlyKeep=2
[root@sme2 ~]#
Title: Re: keys sent successfully to prod box, but affa can't conne
Post by: markseymour on May 17, 2007, 03:25:04 AM
Quote from: "markseymour"
Michael,

Any ideas on this? <snip...>

I should have mentioned, both servers are recent installs updated to 7.1.3.
Title: Re: keys sent successfully to prod box, but affa can't conne
Post by: m on May 17, 2007, 04:54:10 PM
Quote from: "markseymour"
Michael,

Any ideas on this?  (I assume it really has nothing to do with Affa, but with ssh config)


What  happens, when you run
Code: [Select]
ssh 192.168.111.1 true; echo $?
on the Affa server?
Title: Re: keys sent successfully to prod box, but affa can't conne
Post by: markseymour on May 17, 2007, 10:27:59 PM
Quote from: "mweinber"


What  happens, when you run
Code: [Select]
ssh 192.168.111.1 true; echo $?
on the Affa server?

Here's what happens:
Code: [Select]
[root@sme2 ~]# ssh 192.168.111.1 true; echo $?
root@192.168.111.1's password:
0
[root@sme2 ~]#

The '0' is returned after I enter the root password.
I don't know what the above tells you, but just out of
curiosity I also did the following:
Code: [Select]
[root@sme2 ~]# ssh 192.168.111.1 false; echo $?
root@192.168.111.1's password:
1
[root@sme2 ~]#
Title: Re: keys sent successfully to prod box, but affa can't conne
Post by: m on May 17, 2007, 11:02:47 PM
Quote from: "markseymour"

The '0' is returned after I enter the root password.


This indicates, that the public key was not sent properly for some reason. Do it again:
Code: [Select]
affa --send-keys 192.168.111.1
then run again
Code: [Select]
ssh 192.168.111.1 true; echo $?
You now should not be asked for a password.

Quote from: "markseymour"

just out of curiosity I also did the following:

Well, you've got to know two new unix commands ;-), see 'man true' and 'man false'
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on May 18, 2007, 12:25:59 AM
Michael,

Thanks for your replies, and for your terrific work in making Affa.  Obviously, I don't understand much detail of the problem, but I'm trying to learn, and below are some possible clues (if I'm looking in some of the right places).

So, I did as you said:
Code: [Select]
[root@sme2 ~]# affa --send-keys 192.168.111.1
root@192.168.111.1's password:
DSA keys sent to 192.168.111.1
[root@sme2 ~]# ssh 192.168.111.1 true; echo $?
root@192.168.111.1's password:
0
[root@sme2 ~]#

So it seems that my affa box sees a successful sending of keys, but my prod box is silently not accepting a DSA key login?

In Server Manager on the prod box under Security | Remote Access | Secure Shell Settings, I have all along had the following settings:
__Secure shell access:  Allow access only from local networks
__Allow admin. CL access over secure shell:  Yes
__Allow secure shell access using standard passwords:  Yes

Just now, hoping to thunk some new behaviour out of the system, I changed the last one (std. pw) to:  No
and then tried again:
Code: [Select]

[root@sme2 ~]# ssh 192.168.111.1 true; echo $?
Permission denied (publickey).
255


Is that saying that a key-based login has been denied?

In /root/.ssh/known_hosts on my prod box, I see an entry for my affa box:
Code: [Select]
192.168.111.2 ssh-rsa AAAAB3NzaC1y....etc
but nothing about ssh-dsa.  Should I?  
And in /root/.ssh/authorized_keys2 (there is no file called 'authorized_keys'), I see 3 copies of:
Code: [Select]
ssh-dss AAAAB3NzaC1kc3M....etc   root@sme2

Does any of this help?  What else can I provide? Of course you are welcome to tell me to resolve my ssh problems elsewhere, and come back if I need any help with Affa :?
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 18, 2007, 09:58:30 AM
Quote from: "markseymour"

So it seems that my affa box sees a successful sending of keys, but my prod box is silently not accepting a DSA key login?


yes, looks like, that something is messed up. Best thing to do is to start from the scratch:

 - on the source server set Secure Shell Settings to  Allow access only from local networks, Yes, Yes
 - on the source server delete the file /root/authorized_keys2
 - on the Affa server delete the files /root/id_dsa and /root/id_dsa.pub
 - on the Affa server: affa --send-keys --job=mail3prod

Now compare the files /root/id_dsa.pub on the Affa server with the file /root/authorized_keys2 on the source server. They must be identical and you  should ssh log in the source server from the Affa server without being asked for a password.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on May 18, 2007, 04:41:32 PM
Quote from: "mweinber"


yes, looks like, that something is messed up. Best thing to do is to start from the scratch:

 - on the source server set Secure Shell Settings to  Allow access only from local networks, Yes, Yes
 - on the source server delete the file /root/authorized_keys2
 - on the Affa server delete the files /root/id_dsa and /root/id_dsa.pub
 - on the Affa server: affa --send-keys --job=mail3prod

Now compare the files /root/id_dsa.pub on the Affa server with the file /root/authorized_keys2 on the source server. They must be identical and you  should ssh log in the source server from the Affa server without being asked for a password.


Ok, I have done exactly as you said, but I still get the same result.

On the source server, I verified Allow access was back to only from local networks, Yes, Yes, then:
Code: [Select]
[root@mail3 ~]# rm .ssh/authorized_keys2
rm: remove regular file `.ssh/authorized_keys2'? y
[root@mail3 ~]# ls .ssh
config  known_hosts

On the Affa server:
Code: [Select]
[root@sme2 ~]# ls .ssh
config  id_dsa  id_dsa.pub  known_hosts
[root@sme2 ~]# rm .ssh/id_dsa*
rm: remove regular file `.ssh/id_dsa'? y
rm: remove regular file `.ssh/id_dsa.pub'? y
[root@sme2 ~]# affa --send-keys --job=mail3prod
Generating DSA keys...
Successfully created DSA key pair.
root@mail3.guildassociates.com's password:
DSA keys sent to mail3.guildassociates.com
[root@sme2 ~]#

I compared the files with diff after copying with scp.

but, then on the Affa server I still get:
Code: [Select]
[root@sme2 ~]# ssh 192.168.111.1 true; echo $?
root@192.168.111.1's password:
0
[root@sme2 ~]#

I'll try it going the other direction now.....  

To do that I copied and munged the two 'Exec Cmd:' command strings from end of /var/log/affa on the affa server, (the ssh-keygen, and the cat id_dsa.pub piped to ssh) to the source server (from one Putty screen to the other).  The result is that a key-based login works fine going from source server to Affa server; no password requested:
Code: [Select]
[root@mail3 ~]# ssh 192.168.111.2 true; echo $?
0
[root@mail3 ~]#
[root@mail3 ~]# ssh sme2.guildassociates.com true; echo $?
0
[root@mail3 ~]#

ok, now this is getting deep for me.... :x
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on May 18, 2007, 07:15:44 PM
Michael,

I think I've unintentionally hijacked your thread with my ssh difficulties.  I see there are some public key type threads in the old 'Experienced Users' forum which is closed to new posts (although if I understand correctly, I could reply to an existing thread).  Also, I see one called 'public key ssh' in the current 'SME Server 7.x' forum.  

Unless you say otherwise, I think I should search the fora a bit more, and if I don't see this addressed, then I should post this issue as a reply in 'public key ssh' in the current 'SME Server 7.x' forum, and ask an admin to move most of our exchange thus far over there.

Just trying to not be a pain in the @$$  :wink:
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on May 18, 2007, 10:39:03 PM
But, before I leave....

I just thought to check whether sshd on the source server has anything to say about why it is not authenticating the session.
Code: [Select]
From /var/log/sshd/current on the source server:
@40000000464ceabb21dec4cc Authentication refused: bad ownership or modes for directory /root
@40000000464ceabb21e0b8cc Failed publickey for root from 192.168.111.2 port 33059 ssh2
@40000000464ceac236c775dc Accepted password for root from 192.168.111.2 port 33059 ssh2

So I will try to learn about ownership and modes as they relate to authentication of a key-based ssh login to a remote host.  Any further feedback would be appreciated.

Thanks,

Mark
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: soprom on May 18, 2007, 10:39:53 PM
I've tested this contrib on a few systems and it is just great!
If you read this post wondering which backup software to use on SME7, this is the one. If you're not familiar with WinSCP, it's now or never, it's worth it!

Although SME7 implies to manage the system from the GUI and this contrib has no GUI, it is simple and straightforward to use.

The main features in my perspective are the possibility to setup a backup machine ready to take over, and to very easily recover full or part of the system.

Many thanks for this excellent piece of software and for you ingenuity!
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on May 19, 2007, 03:25:41 AM
Michael,

Key-based ssh login works now.
Quote from: "markseymour"

Code: [Select]
From /var/log/sshd/current on the source server:
@40000000464ceabb21dec4cc Authentication refused: bad ownership or modes for directory /root



A friend suggested the next logical question -- 'so what are the permissions of the /root directory?'

The answer seems pretty troubling to me:
Code: [Select]
[root@mail3 ~]# ls -ld /root
dr-x------  7 alias qmail 4096 May 18 10:23
[root@mail3 ~]#

Although I have referred in this thread to my 'production server' it is actually a test server which I had intended to bring online as a replacement for my current Windows mail server after I established a backup configuration.  I have tested various contribs on this server, and I have to wonder if one of them changed the permissions of the /root directory.  I doubt that is the case, but I certainly am not aware of how I could have changed them to alias:qmail myself.  In any case, setting them like this:
Code: [Select]

[root@mail3 ~]# chown root:root /root
[root@mail3 ~]# ls -ld /root
dr-x------  7 root root 4096 May 18 10:23 /root
[root@mail3 ~]#

fixed the key-based ssh login problem.  

I will probably start clean with my source server and not do any testing of contribs on it once it is a production server.

My Affa server has now completed a test backup of my source server.  

Next message:  A quick report of my initial Affa use.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on May 19, 2007, 03:56:57 AM
Brief initial 'casual test' of Affa (i.e. not a thorough test)

Source server is offline, Affa server is up as the test replacement of the source server after performing an
Code: [Select]
[root@sme2 ~]# affa --rise mail3prod
I've tested IMAP email access to the 'risen' server, as well as root ssh login, and server-manager access including the contributed panels User Panel and Email WBL.  

User Panel access appeared not to work correctly.  I logged into https://mail3.guildassociates.com/user-manager on the 'risen' Affa-mail3 server and no user options were shown.  In server-manager under User Panel Access I see that the correct delegated access item checkboxes are 'checked', so I selected the 'Modify' button, and refreshed the browser pointed at user-manager.  Now the options are shown.

Now a problem... seems I can't undo the rise.  On the 'risen' Affa server, now self identified as mail3:
Code: [Select]
[root@mail3 ~]# affa --undo-rise
Error log:
Fri May 18 21:01:01[START.5267]: Running /sbin/e-smith/affa --undo-rise
Fri May 18 21:01:01[undo-rise.5267]: Error: No server base backup found.
Fri May 18 21:01:01[undo-rise.5267]: Exiting. <<<
Affa exited with errors.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 19, 2007, 06:38:10 PM
Quote from: "markseymour"

So I will try to learn about ownership and modes as they relate to authentication of a key-based ssh login to a remote host.  Any further feedback would be appreciated.


Mark, although this is not an Affa issue, you are welcome to add a note to the Affa wiki page. This may point other users to right direction, if they are running into the same problem.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 19, 2007, 06:40:04 PM
Quote from: "soprom"

Many thanks for this excellent piece of software and for you ingenuity!


and many thanks to you for the praise.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 19, 2007, 06:53:54 PM
Quote from: "markseymour"

Now a problem... seems I can't undo the rise.  On the 'risen' Affa server, now self identified as mail3:
Code: [Select]
[root@mail3 ~]# affa --undo-rise
Error log:
Fri May 18 21:01:01[START.5267]: Running /sbin/e-smith/affa --undo-rise
Fri May 18 21:01:01[undo-rise.5267]: Error: No server base backup found.
Fri May 18 21:01:01[undo-rise.5267]: Exiting. <<<
Affa exited with errors.


J have tested the rise and undo-rise again on SME 7.1.3. Both work as expected.
My guess is, that you have run a '--rise' while the server configuration was in an unclean state with the BootstrapConsole flag set. This can happen, if you change the configuration (via the Console) and then do not run the required reboot.  
With BootstrapConsole flag set, Affa skips its own backup, as it assumes that a rise has just run. (Otherswise Affa would backup the just restored data)
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on May 20, 2007, 01:17:01 AM
Michael,

Perhaps some further explanation of the '--rise' and '--undo-rise' processes would be a useful addition to the wiki howto, along with an example that includes both, and emphasizes the need to reboot, and when. I am confused as to where in the sequence of events that manual 'reboots' by the admin are required for things to work correctly.

Quote from: "mweinber"

My guess is, that you have run a '--rise' while the server configuration was in an unclean state with the BootstrapConsole flag set. This can happen, if you change the configuration (via the Console)....

For example, what? -- A server configuration change via the console....  such as, a change to Affa config? to an Affa job? to SME? to Linux config apart from SME? I'm not following your meaning, and I would like to understand. I don't think I made any configuration changes between the time that I started the successful backup and the time that I did the 'affa --undo-rise'.

Quote
...and then do not run the required reboot.  
With BootstrapConsole flag set, Affa skips its own backup,....

I'm sorry, ... skips *making* its own backup, or skips *using* its own backup made previously?  From the rest of your sentence, I think you mean skips making its own backup.

Quote
as it assumes that a rise has just run. (Otherswise Affa would backup the just restored data)


But (I think) /var/log/affa shows that a local backup was made as part of the --rise that I did.

Code: [Select]
Fri May 18 20:39:31[START.17161]: Running /sbin/e-smith/affa --rise mail3prod
...
<snip>
...
Fri May 18 20:39:42[mail3prod.17161]: Backup the affa server base (this host).
Fri May 18 20:39:43[mail3prod.17161]: Exec Cmd: /sbin/e-smith/affa --run AFFA.sme2.guildassociates.com-192.168.111.2
Fri May 18 20:39:44[START.17333]: Running /sbin/e-smith/affa --run AFFA.sme2.guildassociates.com-192.168.111.2
Fri May 18 20:39:45[AFFA.sme2.guildassociates.com-192.168.111.2.17333]: Starting job (localhost,scheduled)
Fri May 18 20:39:45[AFFA.sme2.guildassociates.com-192.168.111.2.17333]: Description: for internal use only
Fri May 18 20:39:45[AFFA.sme2.guildassociates.com-192.168.111.2.17333]: Shifting backup archives...
Fri May 18 20:39:45[AFFA.sme2.guildassociates.com-192.168.111.2.17333]: Nothing to be done.
Fri May 18 20:39:45[AFFA.sme2.guildassociates.com-192.168.111.2.17333]: signaling pre-backup event on localhost
Fri May 18 20:39:48[AFFA.sme2.guildassociates.com-192.168.111.2.17333]: Running rsync...
Fri May 18 20:39:55[AFFA.sme2.guildassociates.com-192.168.111.2.17333]: writing /var/affa/AFFA.sme2.guildassociates.com-192.168.111.2/scheduled.0/.AFFA-REPORT
Fri May 18 20:39:55[AFFA.sme2.guildassociates.com-192.168.111.2.17333]: Job (localhost,scheduled) finished.
Fri May 18 20:39:55[AFFA.sme2.guildassociates.com-192.168.111.2.17333]: Exiting. <<<
Fri May 18 20:39:55[mail3prod.17161]: Exec Out: exitstatus=0

The example in the howto entitled 'Moving a SME 7 server installation to a new hardware using the Affa rise feature' is the one place I see a mention of a need to manually reboot.  This (step 8) comes immediately after the '# affa --rise prodbox' in step 7.  Is this the reboot that I missed? I'm fairly certain that I did not reboot the Affa server after the --rise command, as it reboots itself in the process of rising, and I thought that was it.  Is this what I missed or is there something else?

Finally,  two more questions:

1) Do I assume correctly that the only path for my current *risen* Affa server to become an Affa backup server again is to  start over?

2) Do I assume correctly that upon installing SME, Affa, and additional contribs, that I must configure certain contribs, (I'm thinking of RoundCube) on the Affa server as I would on a new source server?  Or should I expect the configuration will be saved in the backup of the source server, and used when I restore or --rise? In case you are not familiar with where the RoundCube config stores things, Dungog has brief but complete setup instructions here: www.dungog.net/sme/webapp.php#roundcube

Thanks for your terrific work on this, and for your answers.

Mark
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 20, 2007, 01:48:12 PM
Mark,
would please update to version 0.3.2 as soon as it has appeared on the mirrors and run a --undo-rise again?
I have found and fixed a bug. Should work now.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 20, 2007, 05:15:05 PM
Quote from: "markseymour"

2) Do I assume correctly that upon installing SME, Affa, and additional contribs, that I must configure certain contribs, (I'm thinking of RoundCube) on the Affa server as I would on a new source server?  Or should I expect the configuration will be saved in the backup of the source server, and used when I restore or --rise? In case you are not familiar with where the RoundCube config stores things, Dungog has brief but complete setup instructions here: www.dungog.net/sme/webapp.php#roundcube


When you want the Affa server to take over and become your productionserver any time, it is required to have on both machines the same contribs packages installed. The RPMCheck property helps you doing a comparison. It is not required to configure the contribs on the Affa server. A contrib package should be designed in way, that it is automatically reconfigured after a full restore. It should store all configuration data under pathes, which are included in a standard backup. And it should expand all configuration files from its templates during the post-upgrade event.
The Affa rise feature is identical to a restore from a tape. The only differences are, that it is much faster and you need not reconfigure the NICs settings and therefore can be run remotly over the network.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: mmccarn on May 20, 2007, 05:34:05 PM
I posted a while back about using affa to backup a remote windows system running cygwin.  I eventually found lots of posts indicating that cygwin has insurmountable problems with long path names, and decided this could be my problem... Since the exact same AFFA settings work fine with the ubuntu appliance I setup at the other end, I think I was right about cygwin...

My questions now are:

a) Is there any way to pre-build the first backup?  The remote office isn't too far away; I could go there and get a copy of the backup data the first time to avoid the 36 - 48 hours required to download it...

b) I originally set up this job to backup to /var/affa; now I've connected a USB drive and moved /var/affa/<JOB> folder to it (and modified the affa job to use the new path) - but 'affa --list-status...' shows 'Incomplete' for the 'scheduled.0' backup job, and shows "?" for 'files' & 'size' for all backups as well as for 'disk usage' for 'scheduled.0'.  Is there a way to re-build the affa-report db for this backup job,  can I ignore this situation, or do I need to delete this job and start over?

(I have just upgraded to 0.3.2).
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 20, 2007, 06:44:16 PM
Quote from: "mmccarn"
I think I was right about cygwin...


Could be. I have also encountered difficuiltiies to run rsync on cygwin. In my case, the rsync processes on the cygwin machine often hang unresponsive.

Quote from: "mmccarn"

a) Is there any way to pre-build the first backup?  The remote office isn't too far away; I could go there and get a copy of the backup data the first time to avoid the 36 - 48 hours required to download it...

that is an easy job..

either

you run the very first backup with the Affa box located in the LAN of the remote office and then move it to your backup location. If you havn't a VPN. you only need to adjust the remoteHostname to the WAN IP of the remote office.

or

you connect an USB drive to your production server in the remote location and run the backup to the external drive, as described in the wiki docs.
Then connect und mount the drive to the Affa server and copy the archive directory using the tar command:

Code: [Select]

# cd /mnt/affadevice/
# tar -cf - prodbox | tar -C /var/affa -xf -


assuming that the jobname is prodbox and the drive is mounted on /mnt/affadevice


Quote from: "mmccarn"

b) I originally set up this job to backup to /var/affa; now I've connected a USB drive and moved /var/affa/<JOB> folder to it (and modified the affa job to use the new path) - but 'affa --list-status...' shows 'Incomplete' for the 'scheduled.0' backup job, and shows "?" for 'files' & 'size' for all backups as well as for 'disk usage' for 'scheduled.0'.  Is there a way to re-build the affa-report db for this backup job,  can I ignore this situation, or do I need to delete this job and start over?


you probably have used the cp command and not copied the dot-file .AFFA-REPORT

use the tar command
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on May 21, 2007, 02:56:38 AM
Quote from: "mweinber"
Mark,
would please update to version 0.3.2 as soon as it has appeared on the mirrors and run a --undo-rise again?
I have found and fixed a bug. Should work now.


Michael,

I'm fairly new to all this. Do I use yum update to do this?  What command syntax please?

Thanks,

Mark
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on May 21, 2007, 02:59:14 AM
I should have noted that I originally downloaded, then installed with yum localinstall
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 21, 2007, 08:23:07 AM
Quote from: "markseymour"

I'm fairly new to all this. Do I use yum update to do this?  What command syntax please?


Code: [Select]
yum localinstall smeserver-affa-0.3.2-0.noarch.rpm
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on May 21, 2007, 07:23:17 PM
Michael,

What do you envision as the best approach to returning a 'risen' Affa server to standard Affa backup server, after the repaired or replaced source server is ready?  My question is really about the data that has accumulated (email, ibay files, etc.) on the Affa server while it was taking the place of the source server, but it is desired that the Affa server go back to its backup role, and the data accumulated be retained, and restored to the repaired or replaced source server.

Mark
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on May 21, 2007, 10:40:03 PM
'affa --undo-rise'  successful after update to smeserver-affa-0.3.2-0!!!  8)
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 22, 2007, 12:46:23 PM
Quote from: "markseymour"

What do you envision as the best approach to returning a 'risen' Affa server to standard Affa backup server, after the repaired or replaced source server is ready?  My question is really about the data that has accumulated (email, ibay files, etc.) on the Affa server while it was taking the place of the source server, but it is desired that the Affa server go back to its backup role, and the data accumulated be retained, and restored to the repaired or replaced source server.


Mark,
regard your 'risen' Affa server as your production server, which it is in fact now. Forget the 'sleeping' Affa backup function for a moment. Setup your new hardware following the instructions in chapter 'Moving a SME 7 server installation...' in the Wiki (http://wiki.contribs.org/Affa#Moving_a_SME_7_server_installation_to_a_new_hardware_using_the_Affa_rise_feature).
Now, as the production server is up and running, you can make the the Affa server a backup server again. Power it on and run affa --undo-rise, which deletes all the no longer needed production data and restores the Affa setup.  All backup archives are still there and Affa will backup your (new) production server against the last scheduled.0 archive. It's harder to explain, than doing it ;-)
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 22, 2007, 01:00:42 PM
Affa version  0.4.0 is available.
This version has the new functions --rename-job and  --move-archive. Please note, that the syntax of --send-keys has changed. See Wiki (http://wiki.contribs.org/Affa#Usage_and_command_line_options) for further information.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on May 22, 2007, 11:53:53 PM
Michael,

Quote from: "mweinber"
It's harder to explain, than doing it ;-)


Quite so!  After re-reading 'Moving a SME 7 server installation...' in the wiki, in reference to your comment
Quote
regard your 'risen' Affa server as your production server....

all is clear.

Thank you!

Mark
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: mmccarn on May 23, 2007, 05:43:38 PM
Michael - Is there a better place than this ever-growing topic to ask questions?

I can't figure out what 'Disk Usage' indicates in affa --status - my one backup using a USB drive occupies 27GB of disk, but 'Disk Usage' says 27MB.  My other two backups (backing up to /var/affa) occupy ~1.4GB but report 'Disk Usage' of 3.1MB.

Another comment/suggestion:  On my first attempt to run 'affa-job.pl' I didn't notice the entry for $jobname at the top of the file.  I ended up with a config db entry with a blank  job name...  I couldn't figure out how to delete it using 'db affa ...' so I ended up deleting it manually.  Perhaps it would be useful to have an error exit for no job name (the way you do for 'remoteHostName is not set').

Yet another comment/suggestion: add a db entry for "Nervous" or "Chatty" - if "Nervous" is enabled, send emails on success as well as on failure; or perhaps if 'Nervous' is '5', send 5 'success' notices after startup or after any failure.  (I would use this during setup & testing, then fall back to your default mode of error notification only).

I am also working on a secure way to allow my client to access their backups using http, webdav or ftp, but I suspect you don't plan to build this into affa.

Thanks for all your work - I really enjoy being able to setup a backup solution in 30 minutes or less!  Feel free to tell me to keep my suggestions to myself...
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 23, 2007, 10:23:55 PM
Quote from: "mmccarn"


I can't figure out what 'Disk Usage' indicates in affa --status - my one backup using a USB drive occupies 27GB of disk, but 'Disk Usage' says 27MB.  My other two backups (backing up to /var/affa) occupy ~1.4GB but report 'Disk Usage' of 3.1MB.

I have added some more info to the Wiki.
Are the Disk Usage'  values really MB, not GB? If so, it appears to be a bug. What values shows df -h?

Quote from: "mmccarn"

Another comment/suggestion:  On my first attempt to run 'affa-job.pl' I didn't notice the entry for $jobname at the top of the file.  I ended up with a config db entry with a blank  job name...  I couldn't figure out how to delete it using 'db affa ...' so I ended up deleting it manually.  Perhaps it would be useful to have an error exit for no job name (the way you do for 'remoteHostName is not set').

This has been already fixed in the /usr/lib/affa/jobconfig-sample.pl of the current release.

Quote from: "mmccarn"

Yet another comment/suggestion: add a db entry for "Nervous" or "Chatty" - if "Nervous" is enabled, send emails on success as well as on failure; or perhaps if 'Nervous' is '5', send 5 'success' notices after startup or after any failure.  (I would use this during setup & testing, then fall back to your default mode of error notification only).

Great idea. I think about it.

Quote from: "mmccarn"

I am also working on a secure way to allow my client to access their backups using http, webdav or ftp, but I suspect you don't plan to build this into affa.

No such plans.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: mmccarn on May 24, 2007, 05:18:10 AM
Quote from: "mweinber"
This has been already fixed in the /usr/lib/affa/jobconfig-sample.pl of the current release.
Oops.  I was looking at the version I had modified from 0.3.2...

Quote from: "mweinber"
What values shows df -h

Code: [Select]
# affa --status
+----------+---------+--------+-------+--------+------------+----------------+
| Job      | Enabled | Last   | Next  |   Size | Disk usage | N of s,d,w,m,y |
+----------+---------+--------+-------+--------+------------+----------------+
| family   | yes     | 22:31  | 22:30 |  1.3GB |  3.4MB/11% | 2,7,1,0,0      |
| hcm      | yes     | running (pid 19892)     |   36MB/13% | 2,1,0,0,0      |
| sme-mmsi | yes     | 22:30  | 22:30 |  157MB |  3.4MB/11% | 2,7,1,0,0      |
+----------+---------+--------+-------+--------+------------+----------------+


Code: [Select]
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/main-root
                       33G  3.5G   28G  12% /
/dev/md1               99M   20M   75M  21% /boot
none                  125M     0  125M   0% /dev/shm
/dev/sdc1             294G   37G  243G  14% /home/e-smith/files/ibays/hcmbackup/html
Yes, I know I'm not supposed to use /home/e-smith as the RootDir for the backup, but I don't think this is my problem.  The remote data set is approx. 25GB, and as of now the backup has not finished successfully due to a scheduled daily reboot of the source computer (which has now been disabled).  Also NONE of the 3 configured backup jobs have SMEServer set to 'yes', so I'm not planning to use 'rise' at this time...

Quote from: "Affa Wiki"
If all jobs are located in the same RootDir, identical disk usage is shown for all jobs. If RootDir is /var/affa, the usage of the SME server system partition is shown
Clearly, "Disk Usage" does not necessarily represent 'Size' at all; I just don't understand exactly what it does represent.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 24, 2007, 09:33:34 AM
Quote from: "mmccarn"
Clearly, "Disk Usage" does not necessarily represent 'Size' at all; I just don't understand exactly what it does represent.


It simply shows the disk usage of the partition where the archives are located. This also includes all other data on this partition. When you run a decticated backup server it shows on the whole the size of all archives including the small space used by the SME system, which can be safely ignored.

Please update to the new release 0.4.1. The disk usage should now display correct values, according to the df command.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: mmccarn on May 24, 2007, 03:42:59 PM
Quote from: "mweinber"
It simply shows the disk usage
Now I understand... and with 0.4.1 it's so obvious!

I tried to create a 'preJobCommand' and 'postJobCommand' to mount & unmount a samba share on my (remote) source system (without reading the wiki) and discovered that if the 'postJobCommand' fails it drops into a loop where it sends a failure message, then re-tries the command, then sends another failure message, etc, etc...  In case it matters, the postJobCommand I had configured using:
Code: [Select]
db affa setprop hcm postJobCommand "/usr/bin/ssh <remote.host.name> -p 2222 '/bin/umount //backup/backup'"Note: I'm not looking for help fixing the command; after reading the manual I'm good on that score.  I'm just trying to alert you to what happened when 'postJobCommand' returned an error...

Also, I just got the following error trying to do a manual backup:
Code: [Select]
[root@office ~]# affa --stat
Affa version 0.4.1 on office.obfuscated.local (192.168.200.1)
+----------+---------+--------+-------+--------+------------+----------------+
| Job      | Enabled | Last   | Next  |   Size | Disk usage | N of s,d,w,m,y |
+----------+---------+--------+-------+--------+------------+----------------+
| family   | yes     | 22:31  | 22:30 |  1.3GB |  3.5GB/11% | 2,7,1,0,0      |
| hcm      | yes     | failed | 15:30 |      ? |   38GB/13% | 1,2,0,0,0      |
| sme-mmsi | yes     | 22:30  | 22:30 |  157MB |  3.5GB/11% | 2,7,1,0,0      |
+----------+---------+--------+-------+--------+------------+----------------+
[root@office ~]# affa --backup hcm
Argument "rsync error: timeout in data send/receive (code 30) at i..." isn't numeric in numeric eq (==) at /sbin/e-smith/affa line 383.
Use of uninitialized value in substitution (s///) at /sbin/e-smith/affa line 1255.
Use of uninitialized value in division (/) at /sbin/e-smith/affa line 1256.
[root@office ~]# affa --stat
Affa version 0.4.1 on office.obfuscated.local (192.168.200.1)
+----------+---------+--------+-------+--------+------------+----------------+
| Job      | Enabled | Last   | Next  |   Size | Disk usage | N of s,d,w,m,y |
+----------+---------+--------+-------+--------+------------+----------------+
| family   | yes     | 22:31  | 22:30 |  1.3GB |  3.5GB/11% | 2,7,1,0,0      |
| hcm      | yes     | 08:50  | 15:30 |      ? |   38GB/13% | 1,2,0,0,0      |
| sme-mmsi | yes     | 22:30  | 22:30 |  157MB |  3.5GB/11% | 2,7,1,0,0      |
+----------+---------+--------+-------+--------+------------+----------------+
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 24, 2007, 07:57:24 PM
Quote from: "mmccarn"


if the 'postJobCommand' fails it drops into a loop where it sends a failure message, then re-tries the command, then sends another failure message, etc, etc...  

ok, endless looping is really a bad behavior. I have to look for this.

Quote from: "mmccarn"

Argument "rsync error: timeout in data send/receive (code 30) at i..." isn't numeric in numeric eq (==) at /sbin/e-smith/affa line 383.

Rsync timed out for some reason and (should) return exitcode 30, but Affa saw something non-numeric. Can you read the exitstatus from the log?

Quote from: "mmccarn"

Use of uninitialized value in substitution (s///) at /sbin/e-smith/affa line 1255.
Use of uninitialized value in division (/) at /sbin/e-smith/affa line 1256.

These warnings indicate, that the df command failed for the filessystem where the job archives are located on. Any ideas why?
Regardless the reason, Affa should be able to deal with bad return values and needs to be fixed.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: SoftDux on May 28, 2007, 06:44:47 PM
how well does it work with dabases, like MySQL, PostgresSQL and Oracle?
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: mmccarn on May 29, 2007, 01:56:58 PM
Quote from: "SoftDux"
how well does it work with dabases, like MySQL, PostgresSQL and Oracle?
If the affa configuration for the remote host (the source) contains 'SMEserver' not equal to 'no', then affa runs 'signal-event pre-backup' on the source server.  On a SME box this includes a dump of the mysql databases.  If you're also using PostgresSQL & Oracle you'll need to generate a custom process to dump the databases before backup (I think).  If the 'source' is a SME server, you could customize the 'pre-backup' event; if the 'source' is non-SME you can create scripts to be run before & after the backup which can (using ssh) execute commands on the 'source'.  Check the manual for preJobCommand and postJobCommand, and look at the sample scripts in  /usr/lib/affa

Quote from: "mweinber"
Rsync timed out for some reason and (should) return exitcode 30, but Affa saw something non-numeric. Can you read the exitstatus from the log?
Error: rsync failed with status 255
Quote from: "mweinber"
the df command failed for the filessystem where the job archives are located
Possibly a timeout caused by trying to use lame USB 1.1?

Michael - I think I've been fighting two or three separate issues - one related to large files (>2GB) accessed using smbfs on the 'source' server, one related to slow backup disk access (USB 1.1) on my local backup device, and one related to "successfully" backing up an empty mount-point...

I finally found the "lfs" option for "mount -t smbfs" which provides "large file support" - this let me complete two manual 'rsync' runs with no problems.  I later changed the mount command on the source server to use "mount -t cifs", which seems to a) not have problems with large files and b) allow the backup to run faster.

I have also installed a USB 2.0 controller in my backup server...

I also, at one point, while playing with 'preJobCommand' and 'postJobCommand' created a successful backup of the empty mount point on the remote host.

Between these three problems, I became very confused about how the rsync --link-dest function worked.  In an effort to straighten things out I ran the affa rsync command manually, using the largest (most successful?) local backup as the --link-dest (daily.3) and changing the destination folder (scheduled.0, scheduled.1, daily.0) until I had a) run rsync successfully several times in a row, and b) had several successful local copies...  After that I changed the value for 'keepDaily' and ran 'affa --cleanup <job>' to remove the under-sized backups.  Now I've re-enabled the affa schedule and will see what happens.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: SoftDux on May 29, 2007, 02:57:21 PM
Ok, if you say you have issues with large files. How large are the files you are working with?

And how does it perform on USB 2.0?
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 29, 2007, 04:37:28 PM
Quote from: "SoftDux"
how well does it work with dabases, like MySQL, PostgresSQL and Oracle?


Affa does exactly that, what a backup to tape or desktop does (on the source server).
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 29, 2007, 04:51:41 PM
Quote from: "mmccarn"

Between these three problems, I became very confused about how the rsync --link-dest function worked.


when a job starts, affa first rename the scheduled.0 (if it exists and is complete)  to scheduled.1 and then it runs a rsync with link-dest against the scheduled.1 to create a new scheduled.0. All files present in scheduled.1 and unmodified on the source are just hardlinked from scheduled.1 to the scheduled.0. Only modified files are transferred from the source (of course only the chunks, that differs).
If you have accidentally lost scheduled.0 and scheduled.1 a full tranfer from the source will be done. If you still have an older archive e.g. scheduled.2 or daily.0, you can copy it to scheduled.0 using 'cp -al' The -l option for hardlinks is important!
Title: Release 0.4.2
Post by: m on May 29, 2007, 05:20:44 PM
A new release 0.4.2 with some bug fixes (Changelog) (http://wiki.contribs.org/Affa#Changelog) and new property 'chattyOnSuccess  (http://wiki.contribs.org/Affa#Job_configuration_properties)' is available.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: mmccarn on May 29, 2007, 05:46:17 PM
Quote from: "SoftDux"
Ok, if you say you have issues with large files. How large are the files you are working with?
The problem I had with large files was not related to affa or rsync, but stemmed instead from a known issue with samba.  Samba is involved only because I'm using affa to backup a remote Windows system that is only accessible via samba at the remote end.  Adding the "lfs" option to the 'mount' command on my source computer solved the large file issue.  Changing from 'mount -t smbfs...' to 'mount -t cifs...' on the source system solved the file size issue and made the backup run faster.

The specific file that consistently trashed my 'rsync...' is 3.6GB.

Quote from: "SoftDux"
And how does it perform on USB 2.0?
40 times better, of course...  

I have had no rsync errors since upgrading my USB target device from 1.1 to 2.0 and changing the source mount command from '-t smbfs' to '-t cifs'.  I have not run a scheduled affa backup since then, but now that rsync works properly I expect affa to work properly, too.

To clarify: None of my problems were due to affa; I only reported them here in case Michael Weinberger sees something in my fumbling that he wants to address in affa's error handling...
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: mmccarn on May 30, 2007, 03:18:33 PM
A question about .AFFA-REPORT:
The last 3 lines of .AFFA-REPORT say:
Code: [Select]
RootDirFilesystemUsed: 54360144 kbytes
RootDirFilesystemAvail: 237667596 kbytes
RootDirFilesystemUsage: 22.9 %

This is generated (I believe) from this invocation of 'df' in /sbin/e-smith/affa:
Code: [Select]
   390                 (my $fs_type, my $fs_desc, my $used, my $avail) = df $job{'RootDir'};
    391                 print AS "Date: " . Date::Format::time2str("%Y%m%d%H%M",time()) ."\n";
    392                 print AS "$ExecCmdOutout";
    393                 print AS "Exit status: $status\n";
    394                 # Versions <= 0.4.0 printed kbytes values but bytes unit
    395                 printf( AS "RootDirFilesystemUsed: %d kbytes\n", $used );
    396                 printf( AS "RootDirFilesystemAvail: %d kbytes\n", $avail );
    397                 printf( AS "RootDirFilesystemUsage: %.1f %%\n", $used/$avail*100 );


I suspect 'RootDirFilesystemUsage' should really be '$used/$total*100' instead of '$used/$avail*100' (Of course you'd have to create & set $total; I have no idea how to do that...)

'$used/$avail' will over-report usage -- when the drive is 50% full, $used & $avail will be equal and .AFFA-REPORT will report 100% usage...
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on May 30, 2007, 09:11:56 PM
Quote from: "mmccarn"


I suspect 'RootDirFilesystemUsage' should really be '$used/$total*100' instead of '$used/$avail*100' (Of course you'd have to create & set $total; I have no idea how to do that...)

'$used/$avail' will over-report usage -- when the drive is 50% full, $used & $avail will be equal and .AFFA-REPORT will report 100% usage...


a bug. Correct calculation is: $used/($avail+$used)*100
But not a serios issue. RootDirFilesystemUsage in .AFFA-REPORT is just for information (or future use) and not used yet.
Thanks for the report.
Title: Affa, usb backup and rise function
Post by: painkiller on June 03, 2007, 10:16:32 PM
I like this contrib and works good.

I backup the files to a usb disk. Can i use the disk in an clean installed sme to rise. And have a 100 % same server? I don't have a second server to use the rise function but this would be a great option. Can you tell me if this is possible?
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: mmccarn on June 04, 2007, 06:27:12 AM
The manual (http://wiki.contribs.org/Affa) states that the 'rise' function doesn't work if the backups are kept on a different file system (like a USB drive).

You would need to move your latest backup to /var/affa (or some other location on the root filesystem of the new system) and configure affa to use that location for the 'RootDir' before running the "rise".

mweinber has given the command to use when moving affa archives in an earlier post -
Title: Re: Affa, usb backup and rise function
Post by: m on June 04, 2007, 12:35:13 PM
Quote from: "painkiller"
I backup the files to a usb disk. Can i use the disk in an clean installed sme to rise. And have a 100 % same server?


The rise function only works on dedicated backupservers. Affa does not allow a rise on a server from its own backup archive, regardless where it is located on, external or local disk. This is reasonable, as Affa always makes  backup of localhost before the rise. On a dedicated server this backup is almost empty and only contains configuration data. In your case, it would contain all data of your production server, which are already in the archive you use to rise from.

You should run
Code: [Select]
# affa --full-restore JOB scheduled.0
You can run this for a job, which is located on your USB drive. The server can be a fresh install or the existing installation.
This copies the data and configuration from the scheduled.0 archive to your server (and deletes all existing newer data!), signals all necessary events and finally reboots the server. Your server then is in the same state, as it was at the time when scheduled.0 did run.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on June 04, 2007, 12:38:52 PM
Quote from: "mmccarn"

mweinber has given the command to use when moving affa archives in an earlier post -

If you ever need to move an archive, try
Code: [Select]
# affa --move-archive JOB NEWROOTDIR
This function is available since version 0.4.0
Title: ok, thank
Post by: painkiller on June 06, 2007, 06:36:29 PM
I'm gone try this on in a vmware session see if this is working for me. I let you now if this is working for me.
Title: Worked
Post by: painkiller on June 06, 2007, 08:58:55 PM
Ok, vmware sessie started.
mounted usb to clean install of sme.
Copy .pl file and added this to affa database.

affa --full-restore JOB scheduled.0

and al went perfectly thanks all.

In this file i used the mount point that sme generated. (/media/usbdisk) in the howto was suggested that you better can use automount. But SME automount already mine usb disk is it save to use both functions. if not how can you disable SME automount function for only this usbdisk?
Title: Affa version 0.5.0 available
Post by: m on June 12, 2007, 07:09:08 PM
A new Affa version smeserver-affa-0.5.0-0.noarch.rpm (http://wiki.contribs.org/Affa#Download_and_Installation) is available on the mirrors.
Amongst several minor improvements, this version better deals with long term network outage. See changelog (http://wiki.contribs.org/Affa#Changelog) for more details.
I recommend to update.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: mmccarn on June 12, 2007, 07:38:21 PM
Is there a repository I can use for updates, or do I have to update manually?
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on June 12, 2007, 07:43:47 PM
Quote from: "mmccarn"
Is there a repository I can use for updates, or do I have to update manually?


No repo. Please download and update manually.
Title: Affa bugtracker
Post by: m on June 15, 2007, 06:37:20 PM
Affa now is listed in the bugtracker contribs section (http://bugs.contribs.org/enter_bug.cgi?product=SME%20Contribs&component=smeserver-affa).
Please report all bugs, new feature requests and documentation issues there.
Thanks.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on June 20, 2007, 11:45:01 PM
Michael,

You already have a placeholder item in the wiki called:
[Todo] Local Affa server plus a Affa server in remote location.  
Does this represent an un-umplemented/tested capability, or is it
just a matter of documenting something that already has been proven?

It is exactly how I want to use Affa.

Mark
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on June 22, 2007, 12:09:37 AM
Mark,

Quote from: "markseymour"

You already have a placeholder item in the wiki called:
[Todo] Local Affa server plus a Affa server in remote location.  
Does this represent an un-umplemented/tested capability, or is it
just a matter of documenting something that already has been proven?
Mark

Originally have planned to implement some kind of  'chained' setup, i.e. the local Affa server triggers the run on the remote Affa server via the PostJobCommand, which backups the just created scheduled.0 archive. You can do this with Affa as it is now, but on the remote all the archives contains the scheduled.0 of the local Affa server. This makes it impossible to switch over to a standard setting, which backups the production server directly. The remote Affa should run with an option to manipulate the pathes, where I haven't solution for, yet. So I have postponed it for the moment.
The idea of a 'chained' setup was to reduce the load on the production server. But on today's hardware with multi core cpus and fast disks one will hardly notice the additional load.

 
Quote from: "markseymour"

It is exactly how I want to use Affa.

My standard setup for critical servers is a local Affa server with short backup intervals (1 or 2 hours) and a remote Affa server that directly backups the production server nightly (or more frequently if hardware power and bandwidth is sufficient). When you loose your production server you can rise the local Affa server, setup a new Affa hardware and copy the archive from the remote Affe server to it.
When you loose both the production and local Affa server (fire, surge or the like) you still have the Affa server in the remote location. This setup scenario is pretty save, as it's most unlikely that you will loose 3 machines in two independent  locations at the same time.

Edit: latest Affa version is 0.6.0
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: soprom on June 30, 2007, 04:49:19 PM
After upgrading to version 0.6, I receive an error:

I uninstalled previous rpm's and did:
Quote

rpm -i perl-Filesys-DiskFree-0.06-1.2.el4.rf.noarch.rpm
rpm -i smeserver-affa-0.6.1-0.noarch.rpm


Then,
Quote

# affa --status
Argument "de" isn't numeric in multiplication (*) at /usr/lib/perl5/vendor_perl/                                                 5.8.5/Filesys/DiskFree.pm line 144, <HANDLE> line 1.
...
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on July 01, 2007, 12:10:39 PM
Quote from: "soprom"
After upgrading to version 0.6, I receive an error:

Sophie,
please raise a bug in the bugtracker contribs section (http://bugs.contribs.org/enter_bug.cgi?product=SME%20Contribs&component=smeserver-affa).
Thank you.
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: soprom on July 03, 2007, 02:35:17 AM
Bug created!
http://bugs.contribs.org/show_bug.cgi?id=3119
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: soprom on July 03, 2007, 06:47:38 PM
Bug solved in version 0.6.2
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on July 04, 2007, 02:59:21 AM
Michael,

If this looks to you like a bug, I'll be happy to raise it on bugzilla, but first I'd like to be sure I haven't just missed something.

I'm seeing a failure to complete an initial backup on a new installation.

On a fresh installation of SME 7.1 updated to 7.1.3 on last Saturday, I have installed smeserver-affa-0.6.2-0.noarch.rpm by using yum localinstall.  After defining a job using the edited example config .pl file, and after sending the key to the remote host, I ran the job manually.  After this, a scheduled job ran and the log shows the same set of messages for both runs (only first set shown):

[root@smebackup1 ~]# tail -f /var/log/affa
<snip>
Tue Jul  3 20:24:36[START.4249]: Running /sbin/e-smith/affa --run mail3bu
Tue Jul  3 20:24:36[mail3bu.4249]: Checking connection to 192.168.111.1
Tue Jul  3 20:24:36[mail3bu.4249]: Starting job (192.168.111.1,scheduled)
Tue Jul  3 20:24:36[mail3bu.4249]: Description: mail3 backup on vm server
Tue Jul  3 20:24:36[mail3bu.4249]: Installing watchdog on 192.168.111.1
Tue Jul  3 20:24:36[mail3bu.4249]: signaling pre-backup event on 192.168.111.1
Tue Jul  3 20:24:40[mail3bu.4249]: writing list of installed RPMs on 192.168.111.1 (/home/e-smith/db/affa-rpmlist)
Tue Jul  3 20:24:47[mail3bu.4249]: Running rsync...
Tue Jul  3 20:25:21[mail3bu.4249]: writing /var/affa/mail3bu/scheduled.running/.AFFA-REPORT
Tue Jul  3 20:25:21[mail3bu.4249]: Comparing installed RPMs on backup und remote host
Tue Jul  3 20:25:21[mail3bu.4249]: Error 108: Couldn't open /var/affa/mail3bu/scheduled.0/home/e-smith/db/affa-rpmlist
Tue Jul  3 20:25:21[mail3bu.4249]: Email sent to admin,admin@mail3.guildassociates.com
Tue Jul  3 20:25:21[mail3bu.4249]: Exiting. <<<

Contents of /var/affa/mail3bu/scheduled.running/.AFFA-REPORT :
Date: 200707032030
Number of files: 85791
Number of files transferred: 7
Total file size: 12356544483 bytes
Total transferred file size: 27877374 bytes
Literal data: 0 bytes
Matched data: 27877374 bytes
File list size: 2506816
File list generation time: 2.452 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 42498
Total bytes received: 2507136
sent 42498 bytes  received 2507136 bytes  113317.07 bytes/sec
total size is 12356544483  speedup is 4846.40
Exit status: 0
RootDirFilesystemUsed: 13831100 kbytes
RootDirFilesystemAvail: 24897168 kbytes
RootDirFilesystemUsage: 35.7 %

No  /var/affa/mail3bu/scheduled.0 exists, only a  /var/affa/mail3bu/scheduled.running

I saw this same thing happen on a different machine with smeserver-affa-0.6.1

Any ideas?

Mark
Title: last backup - never
Post by: timb on July 04, 2007, 08:10:11 AM
Hi,
I love affa - I have it used it to change the hardware on a 1.0T server to 1.5T (it took a really long time) and I now have a  1.2T server backing up the new 1.5T server. Yes it wlll work at least 0.5T is not being backed up.

Anyway affa --status always reports the last backup occured never. I have backup's scheduled every 4 hours.

Here's a little evidence
[root@galland ~]# affa --status
Affa version 0.6.1 on galland (10.0.0.2)
+--------+---------+--------+-------+--------+------------+----------------+
| Job    | Enabled | Last   | Next  |   Size | Disk usage | N of s,d,w,m,y |
+--------+---------+--------+-------+--------+------------+----------------+
| office | yes     | never  | 18:00 |      - |  842GB/75% | 0,0,0,0,0      |
+--------+---------+--------+-------+--------+------------+----------------+
[root@galland ~]#  time affa --backup office

real    56m38.535s
user    2m15.837s
sys     6m16.195s
[root@galland ~]# affa --status
Affa version 0.6.1 on galland.tbitc.com (10.0.0.2)
+--------+---------+--------+-------+--------+------------+----------------+
| Job    | Enabled | Last   | Next  |   Size | Disk usage | N of s,d,w,m,y |
+--------+---------+--------+-------+--------+------------+----------------+
| office | yes     | never  | 18:00 |      - |  842GB/75% | 0,0,0,0,0      |
+--------+---------+--------+-------+--------+------------+----------------+
[root@galland ~]#
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: m on July 04, 2007, 01:53:14 PM
Mark,
timb,

both issues appear to be bugs.

Please raise a bug in the bugtracker contribs section (http://bugs.contribs.org/enter_bug.cgi?product=SME%20Contribs&component=smeserver-affa).
Thank you.
Title: Before I post as a bug... confessions
Post by: timb on July 05, 2007, 04:46:05 AM
Hi,
My iissue may have been a broken fs.

Briefly here's what I have done / am doing

After posting my rant yesterday - I started hand checking the size of the /var/affa/office/scheduled.running dir and all the shells I used hung.

Warning bells screamed.  A reboot, a damaged fs....

hours running e2fsck - a frightening amount of errors

A reboot.

removed  /var/affa/office/scheduled.running - this took quite some time

a reboot - file system clean

Now running a backup.

It will be a long long time before this completes - its about 900GB over 1G nics....

I will post again when the backup finishes. So count me out of bug reporting till I know my system is not blameless.....

Confession - my hardware is a bit of a hack - it's an intel server m/b (older model) with 2 satas and raid control, with a cheapo 4 port sata card and 6 320gb enterprise drives.

This is not the first FS error we have had (it's the second in 90 days) and I am starting to suspect that this is not a great solution..... built from spare parts you see..

PS Can you get affa to email after every backup?  No matter what? I get backups didnt run emails rarely but thats all. They are a result of me hand launching a backup and then a scheduled one runs.
timb
Title: Re: Before I post as a bug... confessions
Post by: m on July 05, 2007, 08:21:10 AM
Quote from: "timb"

I will post again when the backup finishes.

Then also check the output of affa --list office

Quote from: "timb"


PS Can you get affa to email after every backup?  


Yes. Search for 'chattyOnSuccess' in the Affa wiki (http://wiki.contribs.org/Affa#Job_configuration_properties)
Title: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: markseymour on July 06, 2007, 02:01:00 AM
Michael,

Thanks for the rapid bug fix!

[root@mail3backup ~]# affa --status
Affa version 0.6.3 on mail3backup.nnnn.com (192.168.111.345)
+----------+---------+--------+-------+--------+------------+----------------+
| Job      | Enabled | Last   | Next  |   Size | Disk usage | N of s,d,w,m,y |
+----------+---------+--------+-------+--------+------------+----------------+
| mail3bak | yes     | 17:31  | 20:30 |   12GB |   73GB/28% | 2,0,0,0,0      |
+----------+---------+--------+-------+--------+------------+----------------+


Mark
Title: Issues I have encountered
Post by: timb on August 01, 2007, 02:34:48 AM
I have been expanding my affa installation and I encountered some trouble.
Before I rush to log bugs...

Here's my set up
-----------------------------------------------------------------------------------------------
customer servers(sme) -> internet -> office server (rsync not affa for customers) - local lan

local lan ->affa server (dedicated) for office server
               -> affa2 (sme server) for internal workstations
              -> workstations - linux (of course)
----------------------------------------------------------------------------------------------
Notes
The goal here is that the server office and all workstations should have 1 backup on affa or affa2
Customers data should have 2 backups one on office and one on affa server

customer rsyncs to /var/customer
I used to rsync to /home/e-smith/files/users/customername/home/servername BUT when you do upgrades the S50imaprelocate script collects all the emails in /home/e-smith/files/users/customername/home/servername/home/e-smith/files/users/.... and puts it in weird directories in /home/e-smith/files/users/ and deletes the originals, thus making all backups out of date by the all user email - which in my case means about 24Gb!  It also makes 24gb of disk space dissappear for every yum update you do AND the signal-event post-upgrade takes about 4hrs to run!
I havent logged it as a bug because I think I am miss-using smeserver the way I had things.


I intend to migrate my rsync customer backup system to affa - just would like to see my affa server pickup all of the office server first.
-----------------------------------------------------------------------------------------------

Issue 1:
The customer backups are fine on office - my rsync works well - it's about 2 years old
affa2 contains NO customer backups ie office:/var/customer doesnt propagate
I have added an include statement  'Include[0]'=>'/var/customer
still doesn't propagate.

Issue 2:
affa2 configured to backup workstations with SMEServer No, backs up only /root on the workstations
Setting up 'Include[0]'=>'/'
doesn't help

Sorry for the length of this post
Clues anyone?
Title: Re: Issues I have encountered
Post by: m on August 03, 2007, 11:16:27 AM
Quote from: "timb"
/home/e-smith/files/users/customername/home/servername BUT when you do upgrades the S50imaprelocate script collects all the emails in


What is S50imaprelocate? I don't know this script.
Title: Re: Issues I have encountered
Post by: m on August 03, 2007, 11:25:13 AM
Quote from: "timb"

Issue 1:
The customer backups are fine on office - my rsync works well - it's about 2 years old
affa2 contains NO customer backups ie office:/var/customer doesnt propagate
I have added an include statement  'Include[0]'=>'/var/customer
still doesn't propagate.

Issue 2:
affa2 configured to backup workstations with SMEServer No, backs up only /root on the workstations
Setting up 'Include[0]'=>'/'
doesn't help


Would you please raise a bug in the bugtracker for each issue? Please provide the Affa config. (Output of 'db affa show JOBNAME'). Issue 2: Please provide the output of 'df' command ran on the workstation.
Title: Re: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: dadoudidon on October 18, 2007, 06:20:57 PM
I would like to save all my server 7.2 to an usb disk.
so only one sme in production and a usbdisk connected to save all backups.
for the moment only directories etc, root and home are saved.
I have some application also in opt so i think that more directories have to be backed up.
Here is the list of all directories of my system:

/bin
/boot
/command
/dev
/etc allready saved by affa
/home allready saved by affa
/initrd
/lib
/lost+found
/media (this is where my usbdisk is mounted)
/mnt
/opt
/package
/proc
/root allready saved by affa
/sbin
/selinux
/service
/srv
/sys
/tmp
/usr
/var
and some files at the root of the partition

I think that some directories can be bypass even if i move hardware, but others are needed to retreive a functionnaly server (contribs, template customs...)

Thanks n advance for your help

David
Title: Re: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: piran on October 18, 2007, 07:34:46 PM
David----
Perhaps you use an inappropriate tool?
AFFA is all about backups across the internet or intranet.
DAR2 is (mostly) about backups in the same box or shares.
http://wiki.contribs.org/DAR2
It does all that is needed to restore a complete server.
If you wish or have capacity it will also do your ibays.
My own (h/w) 2TB mounted RAID5 array is backed up
to a 1.5TB Maxtor OneTouchIII Turbo box that's working
in Linux mode and on a USB2 port. Takes ~14hrs to run
off something like 1.2TB overnight, so it is possible.
If you have distributed capacity on the intranet then
DAR2 will use network shared devices or NAS boxes.
----best wishes, Robert
Title: Re: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: raem on October 19, 2007, 07:39:43 AM
dadoudidon

> I would like to save all my server 7.2 to an usb disk.

An alternative if you use RAID1 (2 disks), you can put one of the drives in the server in a removable caddie, and have a spare drive that you swap in/out when you want a full copy of your working server (with all installed apps etc).
Hot swap is not yet supported so you need to power down for 2 minutes.

Make sure you erase the spare disk (in another machine ideally) before you swap the spare drive back in again or the server may resync the drives to the wrong (old) data set.
Title: Re: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: guest22 on January 02, 2008, 01:48:40 PM
Michael,

Just installed Affa 0.8.0, it simply works. Many thanks for this very useful tool.

guest
Title: Re: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: SoftDux on April 14, 2008, 07:27:39 AM
Without reading thought 7 pages worth of stuff, maybe someone could give me some answers to this one. affa doesn't seem to backup at all.

I have a USB HDD attached to my server, and it's haven't disconnected it in days. Here's my config:

Quote
# EDIT THIS:
# used as a key for db and as a filename!
# Choose a name with <= 10 chars.
my $jobname='backup';

# EDIT THIS:
my %job=(
        'remoteHostName'=>'192.168.10.5', # FQHN or IP address
        'TimeSchedule'=>'2230', # HHMM,HHMM,...
        'Description'=>'', # text string.
        'scheduledKeep'=>1, # integer >= 1
        'dailyKeep'=>7, # integer >= 1
        'weeklyKeep'=>4,# integer >= 1
        'monthlyKeep'=>12,# integer >= 1
        'yearlyKeep'=>2,# integer >= 1
        'SMEServer'=>'yes', # yes | no
        'Include[0]'=>'', # additional files or directories to include
        'Include[1]'=>'/etc/mrepo.conf',
        'Include[2]'=>'/etc/mrepo.conf.d',
        'Include[3]'=>'/etc/upsmon/',
        'Exclude[0]'=>'', # files or directories to exclude from backup
        #'Exclude[1]'=>'',
        #'Exclude[2]'=>'',
        'RPMCheck'=>'no', # yes | no
        'DiskSpaceWarn'=>'strict', # strict | normal | risky | none
        'localNice'=>0, # -19...+19
        'remoteNice'=>0, # -19...+19
        'Watchdog'=>'yes', # yes | no
        'sshPort'=>22, # default ssh port is 22
        'ConnectionCheckTimeout'=>120, # seconds
        'rsyncTimeout'=>900, # seconds
        'rsyncCompress'=>'yes', # yes | no
        'EmailAddresses'=>'', # name@domain.com,name@domain.com,...
        'chattyOnSuccess'=>0, # send N success notifications
        'postJobCommand'=>'', # full path to local program/script
        'preJobCommand'=>'', # full path to local program/script
        'AutomountDevice'=>'/dev/sdc2', # Device to auto mount (e.g. USB drive)
        'AutomountPoint'=>'media/usbdisk/', # the mountpoint for AutomountDevice
        'AutomountOptions'=>'', # Optionstring passed to mount command e.g. '-t cifs'
        'AutoUnmount'=>'yes', # umount if fs was not mounted before Affa ran
        'RootDir'=>'/media/usbdisk/affa', # where to save the archives. Don't use /root or /home/e-smith
        'Debug'=>'yes', # yes | no
        'status'=>'enabled', # enabled | disabled
        'rsync--inplace'=>'yes', # yes | no : rsync on source supports '--inplace' option
        'rsync--modify-window'=>0, # integer >= 0, timestamp window
        );

And then when I query the archives, I get the following:

Quote
[root@intranet ~]# affa --list-archives backup
Affa version 0.10.0-1 on intranet.office.softdux.com (192.168.10.5)
+------------------------------------------------------------------------------+
| Job: backup                                                                  |
| Description:                                                                 |
| Directory: /media/usbdisk/affa/backup/                                       |
| Hostname: localhost                                                          |
| AutomountDevice: /dev/sdc2                                                   |
| AutomountPoint: media/usbdisk/                                               |
| AutoUnmount: yes                                                             |
| Email: admin                                                                 |
+-----------------------+----------------+--------------+--------+-------------+
| Date                  | Archive        |        Files |   Size |  Disk usage |
+-----------------------+----------------+--------------+--------+-------------+
[root@intranet ~]#

Here's the funny thing:

Quote
[root@intranet ~]# ll /media/usbdisk/
total 92603180
?---------  ? ?    ?              ?            ? affa
drwx------  4 root root        4096 Mar  7 18:58 backup
drwx------  2 root root       16384 Mar  7 11:37 lost+found
-rw-r--r--  1 root root 94733019884 Apr  8 01:06 smeserver.tgz

I had a folder called affa, which now gives me some funny ? thing, why / what is that?
Title: Re: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: SoftDux on May 02, 2008, 04:47:37 PM
IS this contrib still supported?

Can someone please tell me why it won't be working?
Title: Re: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: Reinhold on May 03, 2008, 12:08:25 AM
IS this contrib still supported?

Can someone please tell me why it won't be working?

Softdux,

"works like a charm" ... see RequestedDeletion's post just before your's.

You do not have to read 7 pages go straight to the manual:
http://wiki.contribs.org/Affa

In your case most likely you have to start affa immediately - or "wait till 22:30" (like the manual says)
(try affa --status) :cool:

Regards
Reinhold




P.S.: Actually this is all that's needed from 0 to a full backup-thingy
Code: [Select]
/usr/bin/yum install --enablerepo=smecontribs smeserver-affa

db affa set prodserv job
db affa setprop prodserv remoteHostName _prodIP_
db affa setprop prodserv RPMCheck yes

affa --send-key prodserv

affa --run prodserv
_prodIP_ = 192.x.x.x = your production server ip
to be found as:
http://wiki.contribs.org/Moving_SME_to_new_Hardware

Correction: unless you want to use a usb disk (like in your case)
where you need to set the directory(like you did)
...but is affa really meant for this ... imho ... not really
please read Michael Weinberger manual compare with dar

Did you try affa --run backup  ??? (not a really meaningful name if you ask me ;) )
Title: Re: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: Drifting on October 05, 2008, 05:20:49 PM
[root@test2 ~]# affa --send-keys test1
Error: Job 'test1' undefined
Error 2329: Error: Job 'test1' undefined

Ok, so two clean installed servers ? What dumb thing have I done now ? I thought I followed the instructions to the letter ?

Paul.
Title: Re: [ANNOUNCEMENT] Turn SME7 into a dedicated backup server
Post by: Drifting on October 05, 2008, 05:56:50 PM
[root@test2 ~]# affa --send-keys test1
Error: Job 'test1' undefined
Error 2329: Error: Job 'test1' undefined

Ok, so two clean installed servers ? What dumb thing have I done now ? I thought I followed the instructions to the letter ?

Paul.

Forget it, I am an idiot, sorry :-)