Changes

From SME Server
Jump to navigationJump to search
1,858 bytes added ,  05:33, 5 July 2019
Line 2: Line 2:  
{{Level|Advanced}}
 
{{Level|Advanced}}
 
{{usefulnote}}
 
{{usefulnote}}
      
=== Maintainer ===
 
=== Maintainer ===
Mainteners(s) Affa3: Arnaud, stephdl<br>
+
Mainteners(s) Affa3: Arnaud, stephdl (and please see above note.)<br>
Development of Affa2 for SME Server by the original maintainer has been discontinued.
+
Copyright (C) 2004-2012 by Michael Weinberger<br>
 
   
=== Version ===
 
=== Version ===
{{ #smeversion: affa}}
+
{{#smeversion: smeserver-affa}}
{{ #smeversion: smeserver-affa}}
  −
 
      
=== Description ===
 
=== Description ===
Line 28: Line 24:  
Affa is a command line tool for system administrators and is intentionally designed without a GUI. Therefore it can be efficiently managed on the console and over slow internet connections.
 
Affa is a command line tool for system administrators and is intentionally designed without a GUI. Therefore it can be efficiently managed on the console and over slow internet connections.
   −
'''Note:''' This documents also refers to the Affa Version 2 which is not maintained anymore. Information on Affa 3 will be gradually added here once it has been more tested.
+
'''Note:''' This document also refers to the Affa Version 2 which is not maintained anymore. Information on Affa 3 will be gradually added here once it has been more tested.
    
==== Affa features at a glance ====
 
==== Affa features at a glance ====
Line 67: Line 63:  
* Log files are rotated weekly, with 5 logs kept
 
* Log files are rotated weekly, with 5 logs kept
   −
<div style="text-align:left" class="mw-collapsible mw-collapsed" data-collapsetext="less &uarr;" data-expandtext="Obsolete Affa 2 instructions &darr;">
+
<div class="mw-collapsible mw-collapsed" style="text-align:left" data-expandtext="Obsolete Affa 2 instructions &darr;" data-collapsetext="less &uarr;">
    
=== Installation or Update of Affa 2 ===
 
=== Installation or Update of Affa 2 ===
Line 113: Line 109:  
Set up a second SME 7 box as your backupserver with hostname 'affabox‘ and IP 10.200.48.2.  
 
Set up a second SME 7 box as your backupserver with hostname 'affabox‘ and IP 10.200.48.2.  
   −
<ol></li><li>log into the 'affabox' and install the packages as described above.
+
<ol><li>log into the 'affabox' and install the packages as described above.
 
</li><li>copy the config helper script sample
 
</li><li>copy the config helper script sample
 
  cp /usr/lib/affa/jobconfig-sample.pl /root/prodbox-job.pl
 
  cp /usr/lib/affa/jobconfig-sample.pl /root/prodbox-job.pl
Line 119: Line 115:  
  my $jobname='prodbox';
 
  my $jobname='prodbox';
 
and
 
and
  'remoteHostName‘=>'10.200.48.1',
+
   
 +
'remoteHostName‘=>'10.200.48.1',
 +
 
 
optionally, if the remote server port is configured to e.g. 2222 then set
 
optionally, if the remote server port is configured to e.g. 2222 then set
  'sshPort'=>2222,
+
   
 +
'sshPort'=>2222,
 
</li><li>save and run the 'prodbox-job.pl' file. This will write the configuration (this makes the database entries and sets up the cronjobs)
 
</li><li>save and run the 'prodbox-job.pl' file. This will write the configuration (this makes the database entries and sets up the cronjobs)
 
  /root/prodbox-job.pl
 
  /root/prodbox-job.pl
Line 191: Line 190:     
  yum install smeserver-affa --enablerepo=smecontribs
 
  yum install smeserver-affa --enablerepo=smecontribs
<headertabs/>
+
<headertabs />
    
The server again need to be updated.
 
The server again need to be updated.
Line 273: Line 272:  
'''Note 1:''' The default values shown in this table are the Affa program defaults and not to be confused with the preset values in the job configuration files, e.g. backup-smeserver.conf.
 
'''Note 1:''' The default values shown in this table are the Affa program defaults and not to be confused with the preset values in the job configuration files, e.g. backup-smeserver.conf.
   −
'''Note 2:''' Affa 3 for SME is a fork of [http://affa.sourceforge.net/ Affa 3 for CentOS]. It adds a few options back again which have been removed. Generally the configuration properties as described [http://wiki.nikoforge.org/Affa_Configuration/ here] do apply. stephdl added the following functions for SME:
+
'''Note 2:''' The complete documentation of the settings of Affa3 is available in [http://affa.sourceforge.net/AffaPdfMan.pdf] . It should be taken in consideration!
 +
 
 +
'''Note 3:''' Affa 3 for SME is a fork of [http://affa.sourceforge.net/ Affa 3 for CentOS]. It adds a few options back again which have been removed. Generally the configuration properties as described [http://wiki.nikoforge.org/Affa_Configuration/ here] do apply. Arnaud added the following functions for SME:
 
<ul>
 
<ul>
 
<li>The parameter “SMEServer”</li>
 
<li>The parameter “SMEServer”</li>
Line 280: Line 281:  
<li>The functions “--rise” and “--undo-rise”</li>
 
<li>The functions “--rise” and “--undo-rise”</li>
 
</ul>
 
</ul>
Consequently the list below should reproduce the list for the unforked Affa 3 version, plus adding the properties above. For details refer to [https://www.guedel.eu/index.php/informatique/sme-server-8/affa-v3 stephdl's website].
+
Consequently the list below should reproduce the list for the unforked Affa 3 version, plus adding the properties above. For details refer to [https://www.guedel.eu/index.php/informatique/sme-server-8/affa-v3 Arnaud's website].
{| border="1" cellpadding="3" cellspacing=0
+
{| border="1" cellspacing="0" cellpadding="3"
 
|-
 
|-
 
| '''Property''' || '''Value''' || '''Multivalue''' || '''Default''' || '''Description'''  
 
| '''Property''' || '''Value''' || '''Multivalue''' || '''Default''' || '''Description'''  
Line 307: Line 308:  
| yes
 
| yes
 
| 2230
 
| 2230
| The time the job will run. Use exactly 4 digits, no colon, no point. '''Important:''' Using the proper format HHMM is essential. Badly formatted TimeSchedule will cause strange Perl errors.
+
| The time the job will run. Use exactly 4 digits, no colon, no point. '''Important:''' Using the proper format HHMM is essential. Badly formatted TimeSchedule will cause strange Perl errors.  Multiple times can be achieved by repeating the line, each line with a different time.
 
|-
 
|-
 
| status  
 
| status  
Line 429: Line 430:  
| no
 
| no
 
| When set to 'no' the job ignores affa --kill or affa --killall when deduplication is running. This is useful in the context of killAt which is typically used to stop bandwith utilisation.
 
| When set to 'no' the job ignores affa --kill or affa --killall when deduplication is running. This is useful in the context of killAt which is typically used to stop bandwith utilisation.
 +
|-
 +
| DiskSpaceWarn
 +
| strict ''or'' normal ''or'' risky ''or'' none
 +
| no
 +
| strict
 +
| Checks disk space remainin on the backup device and issue a warning via email.
 
|-
 
|-
 
| sshPort
 
| sshPort
Line 649: Line 656:  
  '''affa --run JOB'''
 
  '''affa --run JOB'''
 
Starts a job run. Usually done by the cronjob.  
 
Starts a job run. Usually done by the cronjob.  
      
  '''affa --make-cronjobs'''
 
  '''affa --make-cronjobs'''
Configures the cronjobs as scheduled in the jobs records. By default this command will by executed by 'cronjobs' every 15 minutes. So you don't need to run this command manually, you can also just wait max. 15 minutes before your updates job configurations become effective.
+
Configures the cronjobs as scheduled in the jobs records. Run this command to make changes of time related properties effective i.e. TimeSchedule, killAt and resumeKilledAt properties. By default this command will by executed by 'cronjobs' every 15 minutes. So you don't need to run this command manually, you can also just wait max. 15 minutes before your updates job configurations become effective.
    
  '''affa --configcheck'''
 
  '''affa --configcheck'''
 
Checks the syntax and values in all configuration files found in /etc/affa/. Run this command after modifying the configuration. Lower/Upper case errors in property names are corrected automatically.
 
Checks the syntax and values in all configuration files found in /etc/affa/. Run this command after modifying the configuration. Lower/Upper case errors in property names are corrected automatically.
  −
'''affa --make-cronjobs'''
  −
Configures the cronjobs. Run this command to make changes of time related properties effective i.e. TimeSchedule, killAt and resumekKilledAt properties. Every 15 minutes Affa checks whether a configuration file is newer than the cronjob file and runs the make-cronjobs command if this is the case.
      
  '''affa --send-key [JOB JOB ...]'''
 
  '''affa --send-key [JOB JOB ...]'''
Line 823: Line 826:     
  '''affa --cleanup JOB'''
 
  '''affa --cleanup JOB'''
After you have lowered a keep value, e.g. scheduledKeep, then archives with a higher indices will no longer be shifted and will exist for ever. This option finds these archives and deletes them after confirmation.
+
After you have lowered a keep value, e.g. scheduledKeep, then archives with a higher indices will no longer be shifted and will exist for ever. This option finds these archives and deletes them after confirmation. When running the cleanup command on a locally attached USB drive, manually mount the USB drive BEFORE running this command. When finished, manually unmount the USB drive. This requirement may apply to some of the other commands listed here.
    
  '''affa --rename-job JOB NEWNAME'''
 
  '''affa --rename-job JOB NEWNAME'''
Line 865: Line 868:  
Enables verbose logging. Overrides job and global configurations.
 
Enables verbose logging. Overrides job and global configurations.
   −
==== SME Specific usage and command line options ====
+
=== SME Specific usage and command line options ===
    
These commands are implemented in a fork of Affa 3 project for use with SME. They are not part of the Affa 3 for CentOS project.
 
These commands are implemented in a fork of Affa 3 project for use with SME. They are not part of the Affa 3 for CentOS project.
 +
 +
==== SME server 'rise' function ====
 +
 +
{{Note box|Before trying a rise please check /var/affa/YourServer/rpms-missing.txt
 +
 +
You may find there are missing rpms/contribs that template fragments depends on.
 +
 +
It may be necessary to install some of these rpms before a rise to prevent issues.
 +
}}
 +
 +
The SME server version of Affa has a unique feature restore feature enabling you to turn your Affa backup server into a replica of your server. It is an <b>extremely</b> fast way to restore your server.
    
  '''affa --rise [--all] JOB [ARCHIVE]'''
 
  '''affa --rise [--all] JOB [ARCHIVE]'''
 
Runs a full restore on the Affa server <b>(!!!)</b> of all standard files and directories from the backup ARCHIVE of job JOB. In other words: After completion, the Affa box reboots as a clone of the source server. Ensure, that the source server has been powered off before you reboot the Affa box, otherwise the network interface will not come up. This is important, when you run --rise remotely. The --rise feature only works with SME servers and should only be used on dedicated backup servers.
 
Runs a full restore on the Affa server <b>(!!!)</b> of all standard files and directories from the backup ARCHIVE of job JOB. In other words: After completion, the Affa box reboots as a clone of the source server. Ensure, that the source server has been powered off before you reboot the Affa box, otherwise the network interface will not come up. This is important, when you run --rise remotely. The --rise feature only works with SME servers and should only be used on dedicated backup servers.
   −
With option --all, all files and directories of the archive as defined by the include[] properties are restored. Files or directories with the same name on the Affa server will be overwritten and cannot be restored by a undorise. This should not be an issue on a dedicated Affa server which does not hold any other data. After a possible undorise those additional restored data must be removed manually.
+
With option --all, all files and directories of the archive as defined by the include[] properties are restored. Files or directories with the same name on the Affa server will be overwritten and cannot be restored by a --undo-rise. This should not be an issue on a dedicated Affa server which does not hold any other data. After a possible --undo-rise those additional restored data must be removed manually.
   −
Please note, that the rise process backs up the the Affa server itself before doing the restore from the archive. This backup is used by a possible undorise run to restore the Affa server. Only the standard files and directories are backed up. Data in non-standard loctions (like /opt) are untouched and will still exist after the rise run.
+
Please note, that the rise process backs up the the Affa server itself before doing the restore from the archive. This backup is used by a possible --undo-rise run to restore the Affa server. Only the standard files and directories are backed up. Data in non-standard locations (like /opt) are untouched and will still exist after the rise run '''if they don't get overwritten by data of the backup''' (=if the backup contains /opt too e.g.).
    
{{Note box|The above command is not implemented in Affa 3 for CentOS. It has been specifically added to the fork for SME.}}
 
{{Note box|The above command is not implemented in Affa 3 for CentOS. It has been specifically added to the fork for SME.}}
    
  '''affa --undo-rise'''
 
  '''affa --undo-rise'''
This feature reverts a risen Affa box to a backup server. After a reboot, all configured jobs will work again.
+
This feature reverts a risen Affa box to a backup server. After a reboot, all configured jobs '''based on standard files and directories''' will work again.
    
{{Note box|The above command is not implemented in Affa 3 for CentOS. It has been specifically added to the fork for SME.}}
 
{{Note box|The above command is not implemented in Affa 3 for CentOS. It has been specifically added to the fork for SME.}}
Line 962: Line 976:  
* crosscheck your work using the df command
 
* crosscheck your work using the df command
 
  df
 
  df
  −
===== Copying a AFFA USB hard drive archive to a new disk =====
  −
Affa uses copious amounts of hard links to compress and preserve disk space for its backups. If you are in the situation where you want to copy such a disk archive to a new (bigger) disk, you need to ensure that the hard  links are copied correctly or the destination copy may became significantly bigger than the total of the source archive.
  −
  −
One way to copy across file systems (i.e. two different USB disks) and preserve the hard links is as follows:
  −
  −
* mount both USB drives but with different mount points. e.g. /media/backup1 & /media/backup2 and then:
  −
  −
mkdir /media/backup2/archive
  −
cd /media/backup1/archive
  −
tar cpf - . | ( cd /media/backup2/archive && tar xpf - )
  −
  −
where '''archive''' is the name of the AFFA job you want to move to the other disk.
      
===== Setup Affa =====
 
===== Setup Affa =====
 
You want to run backups on 11:30 h, 15:30 h and 19:30 h and you want to keep the last 3 scheduled backups, 7 daily, 5 weekly, 12 monthly and 1 yearly backups.
 
You want to run backups on 11:30 h, 15:30 h and 19:30 h and you want to keep the last 3 scheduled backups, 7 daily, 5 weekly, 12 monthly and 1 yearly backups.
 
* log into the 'prodbox' and install the Affa packages as described above.
 
* log into the 'prodbox' and install the Affa packages as described above.
* copy the config helper script sample
+
* create/edit the conf file of the job: nano /etc/affa/prodbox.conf
cp /usr/lib/affa/jobconfig-sample.pl /root/prodbox-job.pl
+
and set:
* edit /root/prodbox-job.pl and set
+
  [prodbox]
  my $jobname='prodbox';
+
  remoteHostName=localhost
and
+
  TimeSchedule=1130
  'remoteHostName‘=>'localhost',
+
TimeSchedule=1530
  'TimeSchedule'=>'1130,1530,1930',
+
TimeSchedule=1930
  'scheduledKeep'=>3,
+
  scheduledKeep=3
  'dailyKeep'=>7,
+
  dailyKeep=7
  'weeklyKeep'=>5,
+
  weeklyKeep=5
  'monthlyKeep'=>12,
+
  monthlyKeep=12
  'yearlyKeep'=>1,
+
  yearlyKeep=1
  'RootDir=>'/mnt/affadevice',
+
  RootDir=/mnt/affadevice
 
Review the other properties and change them to your needs.
 
Review the other properties and change them to your needs.
* write the configuration
  −
/root/prodbox-job.pl
   
* run the job manually
 
* run the job manually
   
  affa --run prodbox
 
  affa --run prodbox
      
===== Limitations =====
 
===== Limitations =====
Line 1,007: Line 1,004:     
In the NAS example set
 
In the NAS example set
  'AutomountDevice=>'10.200.48.2:/mnt/affashare',
+
  AutomountDevice=10.200.48.2:/mnt/affashare
  'AutomountPoint =>'/mnt/affadevice',
+
  AutomountPoint=/mnt/affadevice
 
and skip the step 2.
 
and skip the step 2.
    
In the USB drive example set
 
In the USB drive example set
  'AutomountDevice=>'/dev/sdc1',
+
  AutomountDevice=/dev/sdc1
  'AutomountPoint =>'/mnt/affadevice',
+
  AutomountPoint=/mnt/affadevice
 
and skip the steps 5 to 8.
 
and skip the steps 5 to 8.
    
The mount point will be automatically created, if it does not exist. <br>
 
The mount point will be automatically created, if it does not exist. <br>
 
To access the archive directory, you need to mount it manually.
 
To access the archive directory, you need to mount it manually.
 +
 +
==== Copying a AFFA USB hard drive archive to a new disk ====
 +
Affa uses copious amounts of hard links to compress and preserve disk space for its backups. If you are in the situation where you want to copy such a disk archive to a new (bigger) disk, you need to ensure that the hard  links are copied correctly or the destination copy may became significantly bigger than the total of the source archive.
 +
 +
One way to copy across file systems (i.e. two different USB disks) and preserve the hard links is as follows:
 +
 +
* mount both USB drives but with different mount points. e.g. /media/backup1 & /media/backup2 and then:
 +
 +
mkdir /media/backup2/archive
 +
cd /media/backup1/archive
 +
tar cpf - . | ( cd /media/backup2/archive && tar xpf - )
 +
 +
where '''archive''' is the name of the AFFA job you want to move to the other disk.
    
=== Restore ===
 
=== Restore ===
 
==== Restore single files or directories ====
 
==== Restore single files or directories ====
 +
 
'''Example 1:'''  It's Tuesday January 6th 2009, when user 'briedlin' asks you to restore the messages of his mailbox 'orders' he has accidentally deleted on Monday.
 
'''Example 1:'''  It's Tuesday January 6th 2009, when user 'briedlin' asks you to restore the messages of his mailbox 'orders' he has accidentally deleted on Monday.
   Line 1,062: Line 1,073:     
==== Full restore ====
 
==== Full restore ====
To run a full restore of user and configuration data, run on the Affa server
+
 
  affa --full-restore <JOB> [<ARCHIVE>]
+
{{Note box|Please for notes about rpms-missing.txt above: https://wiki.contribs.org/Affa#SME_Specific_usage_and_command_line_options}}
This rsyncs the data from the backup ARCHIVE back to the 'remoteHostname' defined in the configuration of the job JOB.  
+
 
 +
Generally:
 +
  '''affa --full-restore [optional settings] JOB [ARCHIVE]'''
 +
This rsyncs the data (files and directories )from the backup ARCHIVE back to the 'remoteHostname' defined in the configuration of the job JOB.
 +
If ARCHIVE is not given, the archive 'scheduled.0' is used as the default.
 +
The --full-restore reconstructs the server as it was at the time of the backup and takes following IMPORTANT optional settings in consideration:
 +
 
 +
With option [--preserve-newer=yes] files on the remote server with modification time newer than on the backup are not overwritten.
 +
 
 +
With option [--delete=yes] all files on the remote server, which are not in the backup, are deleted.
 +
 
 +
If the parameter “SMEServer=yes” is set, the signal-event pre-restore and signal-event post-upgrade will be used automatically.
 +
 
 +
After the restore is done, the restored server reboots automatically.  
    
Example:
 
Example:
You have backuped your production server 'prodsrv' as job 'prodbox'. To restore from the latest backup run
+
You have backuped your production server 'prodsrv' as job 'prodbox'. To restore only lost data from the latest backup run
 
  affa --full-restore prodbox
 
  affa --full-restore prodbox
   −
To restore from the older archive daily.3 run  
+
To restore exactly from the older archive daily.3 run  
  affa --full-restore prodbox daily.3
+
  affa --full-restore [--preserve-newer=no] [--delete=yes]  prodbox daily.3
   −
{{Warning box| A full restore reconstructs the server as it was at the time of the backup. That means, that all files created or server configuration changes made after the backup will be lost. After the restore is done, the restored server reboots automatically. }}
+
{{Warning box|A full restore with --preserve-newer no and --delete yes reconstructs the server as it was at the time of the backup. That means, that all files created or server configuration changes made after the backup will be lost! }}
   −
==== Moving a SME server installation to new hardware using the Affa rise feature ====
+
==== Moving a SME server installation to new hardware using the Affa rise feature or the backup-restore functions ====
 
Please see this Howto: [[Moving SME to new Hardware]]
 
Please see this Howto: [[Moving SME to new Hardware]]
      
==== Restore from USB drive on new server ====
 
==== Restore from USB drive on new server ====
Line 1,085: Line 1,108:  
Q) I have complete backups using affa stored on a usb hard drive connected to our affa backup server. I need to restore an earlier monthly backup of our job "mailbackup" to a test server rather than back to the original system.  If I did it from the backup server I see the instructions of how to rise that server to the current backup on that server but I want to restore a point about a month ago before some strange things happened. And I want to do it on a machine that is not our backup server or our production server. I tried to figure out how but am lost in the options. My goal is to do some testing.
 
Q) I have complete backups using affa stored on a usb hard drive connected to our affa backup server. I need to restore an earlier monthly backup of our job "mailbackup" to a test server rather than back to the original system.  If I did it from the backup server I see the instructions of how to rise that server to the current backup on that server but I want to restore a point about a month ago before some strange things happened. And I want to do it on a machine that is not our backup server or our production server. I tried to figure out how but am lost in the options. My goal is to do some testing.
   −
A) On your testserver setup a job mailbackup identical to that on your backup server but set property RootDir to /var/affa and property status to disabled. Connect the USB drive and copy the archive of  the job mailbackup to /var/affa. Then run affa --rise mailbackup ARCHIVE
+
A) On your testserver setup a job "mailbackup" identical to that on your backup server (a copy of the conf file is available into the folder of the archive, as an hidden file ''.mailbackup-setup.ini'') but set property '''RootDir''' to /var/affa and property '''status''' to disabled. Connect the USB drive and copy the archive of  the job mailbackup to /var/affa. Then run affa --rise mailbackup ARCHIVE
 
  −
Remember that Affa places job setup scripts into the archive directories. In your case it is mailbackup-setup.pl. Copy it to your testserver, change the RootDir and status properties and execute it.
      
=== FAQ ===
 
=== FAQ ===
Line 1,094: Line 1,115:  
With SMEServer=no nothing at all.
 
With SMEServer=no nothing at all.
   −
With SMEServer=yes the SME default backup list.  
+
With SMEServer=yes the SME default backup list is the output of following command:
 
+
perl -e 'use esmith::Backup;$b=new esmith::Backup;print join("\n",$b->restore_list)."\n"'
 +
and as additional folder:
 +
/etc/affa
    
{{Note box|The following example needs to be reworked for Affa 3.}}
 
{{Note box|The following example needs to be reworked for Affa 3.}}
Line 1,149: Line 1,172:       −
{{#bugzilla:columns=id,product,version,status,summary |sort=id |order=desc |component=smeserver-affa|noresultsmessage="No open bugs found."}}
+
{{#bugzilla:columns=id,product,version,status,summary |sort=id |order=desc |disablecache=1|component=smeserver-affa|noresultsmessage="No open bugs found."}}
    
=== Additional information ===
 
=== Additional information ===

Navigation menu