Changes

From SME Server
Jump to navigationJump to search
16,514 bytes added ,  23:21, 1 July 2016
Line 124: Line 124:  
Créer maintenant manuellement un répertoire pour les fichiers d'archives :
 
Créer maintenant manuellement un répertoire pour les fichiers d'archives :
 
  mkdir /var/affa
 
  mkdir /var/affa
 +
{{Note box|type=Attention :|traduction en cours…}}
 +
=== Creation of backup jobs ===
 +
Job configurations of Affa 3 are no longer stored in an e-smith style database. They are stored in configuration files located in ''/etc/affa'' . Create your configuration files in this directory, e.g.
 +
touch /etc/affa/backup-smeserver.conf
 +
where ''backup-smeserver'' is your jobname, and add content as described below.
 +
 +
==== Quick start example ====
 +
You have a SME production server with hostname 'smeserver‘ and IP 192.168.0.2.<br>
 +
You have a second SME box as your backup server with hostname 'affabox‘ and IP 192.168.0.10.
 +
 +
Login to your 'affabox' as root and edit ''/etc/affa/backup-smeserver.conf'' . Using e.g. editor ''nano'', create the following example job configuration file for jobname ''backup-smeserver'' :
 +
[backup-smeserver]
 +
remoteHostName=192.168.0.2
 +
SMEServer=yes
 +
Watchdog=yes
 +
RPMCheck=yes
 +
ConnectionCheckTimeout=120
 +
Debug=no
 +
Description=Backup of 192.168.0.2 smeserver.athome.xx
 +
DiskSpaceWarn=strict
 +
RootDir=/var/affa
 +
TimeSchedule=0630
 +
localNice=15
 +
remoteNice=15
 +
rsync--inplace=yes
 +
rsyncCompress=no
 +
rsyncTimeout=900
 +
scheduledKeep=1
 +
dailyKeep=7
 +
weeklyKeep=4
 +
monthlyKeep=12
 +
yearlyKeep=1
 +
status=enabled
 +
Then save your job configuration file.
 +
 +
Now check that your configuration is OK:
 +
affa --configcheck
 +
This should throw out no errors. Now create / send key files to your productive smeserver:
 +
affa --send-key backup-smeserver
 +
The following output should appear on the console:
 +
Job sme-backup: Generating DSA keys...
 +
Successfully created DSA key pair.
 +
root@192.168.0.2's password: <Enter password of 192.168.0.2/smeserver and hit ENTER>
 +
Public key sent to 192.168.0.2
 +
Now run your job manually, both for test purposes, as well as to create DSA keys:
 +
affa --run backup-smeserver
 +
The following output should appear on the console:
 +
The authenticity of host 'backup-smeserver (192.168.0.2)' can't be established.
 +
RSA key fingerprint is 3b..........65.
 +
Are you sure you want ton continue connecting (yes/no)? <yes>
 +
Now your backup job should run for the first time. Depending on the volume of the files, this takes quite a while.
 +
 +
Once the job is done, check that the archive is available:
 +
affa –-list-archives
 +
 +
or run the job a second time:
 +
affa --run backup-smeserver
 +
Note that you won't be asked for the password again. Note as well, that this second run of the job ''backup-smeserver'' should run considerably faster, because not all files are copied again: just the difference to the previous run is backuped, the rest is stored as hard links to the existing file copies.
 +
 +
Check that the second archive is available too:
 +
affa --list-archives
 +
 +
From here you are able to work as with Affa 2. Modify your config file as required and described below. Automate the backup using the command ''affa --make-cronjobs'', see below.
 +
 +
==== Job configuration properties ====
 +
'''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:
 +
<ul>
 +
<li>The parameter “SMEServer”</li>
 +
<li>The parameter and function “Watchdog”</li>
 +
<li>The parameter and function “RPMCheck”</li>
 +
<li>The functions “--rise” and “--undo-rise”</li>
 +
</ul>
 +
Consequently the list below should reproduce the list for the unforked Affa 3 version, plus adding the properties above. For details refer to [http://www.guedel.eu/index.php/info-matique/sme-server/affa-v3/ stephdl's website].
 +
{| border="1" cellpadding="3" cellspacing=0
 +
|-
 +
| '''Property''' || '''Value''' || '''Multivalue''' || '''Default''' || '''Description'''
 +
|-
 +
| remoteHostName
 +
| FQHN or IP
 +
| no
 +
| <none>
 +
| FQHN or IP of the source host (mandatory)
 +
|-
 +
| remoteUser
 +
| account
 +
| no
 +
| root
 +
| The user account to be used with all ssh logins. May be case sensitive, e.g. Administrator account on Windows
 +
|-
 +
| Description
 +
| text string
 +
| no
 +
| <none>
 +
| Any text that describes the job
 +
|-
 +
| TimeSchedule
 +
| HHMM
 +
| yes
 +
| 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.
 +
|-
 +
| status
 +
| enabled ''or'' disabled
 +
| no
 +
| enabled
 +
| When set to disabled, no cron entries will made. You can still run a job manually.
 +
|-
 +
| Include
 +
| full path
 +
| yes
 +
| <none>
 +
| File(s) or directory(s) to be included in the backup.
 +
|-
 +
| Exclude
 +
| full path
 +
| yes
 +
| <none>
 +
| File(s) or directory(s) to be excluded from the backup.
 +
|-
 +
| RootDir
 +
| full path
 +
| no
 +
| /var/affa
 +
| where to store the backup archives. Do not use /home/e-smith or /root as these are included in the backup and therefore the rise option will not work! Recommended: /var/affa
 +
|-
 +
| scheduledKeep
 +
| integer >= 1
 +
| no
 +
| 1
 +
| how many of the scheduled backups to be kept
 +
|-
 +
| dailyKeep
 +
| integer >= 0
 +
| no
 +
| 7
 +
| how many of the daily backups to be kept
 +
|-
 +
| weeklyKeep
 +
| integer >= 0
 +
| no
 +
| 4
 +
| how many of the weekly backups to be kept
 +
|-
 +
| monthlyKeep
 +
| integer >= 0
 +
| no
 +
| 12
 +
| how many of the monthly backups to be kept
 +
|-
 +
| yearlyKeep
 +
| integer >= 0
 +
| no
 +
| 2
 +
| how many of the yearly backups to be kept
 +
|-
 +
| EmailAddress
 +
| name@domain.com
 +
| yes
 +
| root
 +
| comma separated list of mail addresses, where the messages should be sent to<br>'''Note:''' By default Affa only sends messages on errors, never on success (see property chattyOnSuccess).
 +
|-
 +
| RetryAttempts
 +
| integer >= 0
 +
| no
 +
| 4
 +
| When set to a value>0, Affa re-run a failed job RetryAttempts times with a delay of RetryAfter seconds.
 +
|-
 +
| RetryAfter
 +
| seconds >= 0
 +
| no
 +
| 900
 +
| when set to a value>0, wait RetryAfter seconds before re-running the job after an error. Only applicable with RetryAttempts>0
 +
|-
 +
| RetryNotification
 +
| yes ''or'' no
 +
| no
 +
| no
 +
| when set to no, Affa does not send an error message when a job has failed and RetryAttempts is configured. An error message is only sent when the last attempt has failed.
 +
|-
 +
| NRPEtrigger
 +
| hours
 +
| no
 +
| 24
 +
| NRPE reports a job as critical when the last successful run is older then NRPEtrigger hours. To exclude the job from monitoring set to a value < 0.
 +
|-
 +
| SambaShare
 +
| yes ''or'' no
 +
| no
 +
| no
 +
| Access to the job archives via CIFS protocol.
 +
|-
 +
| SambaValidUser
 +
| local account
 +
| yes
 +
| affa
 +
| User who has permission to access the job archives via the CIFS protocol.
 +
|-
 +
| preJobCommand<br> preJobCommandRemote
 +
| path relative to /etc/affa/scripts/
 +
| yes
 +
| <none>
 +
| Scripts to be executed before a job run. The job name and type (scheduled, daily etc.) are passed as arguments to the program. The preJobCommandRemote scripts are copied to the remote server and then executed there. The scripts are executed in alphabetical order. Use a numerical prefix if you need a specific order e.g. 01scriptB, 02remotescriptA, 03scriptA. Use the included prescript-sample.pl and prescriptRemote-sample.pl as a starting point for own scripts.<br>'''Note:''' If you use the parameter “SMEServer=yes”, you may delete the “Included” relative to SME default directories in the jobconfig.ini: they will be backuped automatically.
 +
|-
 +
| postJobCommand<br> postJobCommandRemote
 +
| path relative to /etc/affa/scripts/
 +
| yes
 +
| <none>
 +
| Scripts to be executed after a job run. The job name, the type (scheduled, daily etc.) and the exit code of the job run are passed as arguments to the program. The postJobCommandRemote scripts are copied to the remote server and then executed there. The scripts are executed in alphabetical order. Use a numerical prefix if you need a specific order e.g. 01scriptB, 02remotescriptA, 03scriptA. Use the included postscript-sample.pl and postscriptRemote-sample.pl as a starting point for own scripts.<br>'''Note:''' If you use the parameter “SMEServer=yes”, you may delete the “Included” relative to SME default directories in the jobconfig.ini: they will be backuped automatically.
 +
|-
 +
| dedup
 +
| yes ''or'' no
 +
| no
 +
| no
 +
| The purpose of the deduplication is to remove duplicate files to save backup space. When set to 'yes' file deduplication is run after the synchronization has been completed. It looks for files that have identical content, user, group and permissions and replace duplicates by hardlinks. Deduplication scans the just completed archive and the previous one, that usually is
 +
scheduled.0 and daily.0 or scheduled.0 and scheduled.1. Consider this scenario: A user has renamed directories or files. Rsync sees those as new ones and copies them. Deduplication finds the identical copies in the previous archive and replace them by hardlinks. To use deduplication the Freedup program needs to be installed. Affa actually runs freedup -upg scheduled.0 <previous_archive>.
 +
|-
 +
| dedupKill
 +
| yes ''or'' no
 +
| 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.
 +
|-
 +
| sshPort
 +
| service port
 +
| no
 +
| 22
 +
| When sshd on the remote host listens on a non-standard port, set the port here.
 +
|-
 +
| ConnectionCheckTimeout
 +
| seconds
 +
| no
 +
| 120
 +
| Affa checks the ssh connection before the rsync process is started and exits with an error after the configured time if the host did not respond.
 +
|-
 +
| BandwidthLimit
 +
| integer>=0 kilobytes per second
 +
| no
 +
| 0
 +
| Limits the data transfer rate. A value of zero specifies no limit.
 +
|-
 +
| rsyncTimeout
 +
| seconds
 +
| no
 +
| 900
 +
| Rsync exits after the configured time if no data was transferred. This avoids infinitely hanging in case of a network error.
 +
|-
 +
| rsyncCompress
 +
| yes ''or'' no
 +
| no
 +
| yes
 +
| Compress the transferred data. May be useful with slow internet connections. Increases CPU load on remote and backup host.
 +
|-
 +
| rsync--inplace
 +
| yes ''or'' no
 +
| no
 +
| yes
 +
| Set to no if the rsync version on the remote hist does not support this option.
 +
|-
 +
| rsync--modify-window
 +
| integer >= 0
 +
| no
 +
| 0
 +
| When comparing two timestamps, rsync treats the timestamps as being equal if they differ by no more than the modify-window value. This is normally 0 for an exact match. A value >= 0 is useful if you can't get the clocks of the remote host and the Affa server in sync.
 +
|-
 +
| rsyncOptions
 +
| string
 +
| no
 +
| <none>
 +
| Additional option string to be passed to rsync
 +
|-
 +
| localNice
 +
| -19...+19
 +
| no
 +
| 0
 +
| run rsync local process niced.
 +
|-
 +
| remoteNice
 +
| -19...+19
 +
| no
 +
| 0
 +
| run rsync process on source niced.
 +
|-
 +
| killAt
 +
| HHMM
 +
| no
 +
| <none>
 +
| The time at which a job will be killed if it was still running. You can use it for example to kill jobs that are running over the internet early in the morning so that your users have the full bandwidth available during office hours.
 +
|-
 +
| resumeKilledAt
 +
| HHMM
 +
| no
 +
| <none>
 +
| The time at which a killed job will be resumed. This allows you to start earlier in the evening than the scheduled time.
 +
|-
 +
| chattyOnSuccess
 +
| integer >= 0
 +
| no
 +
| 0
 +
| When set to a value>0, Affa sends a message on a successfully completed job run and decrements the chattyOnSuccess value. When the value has reached zero, Affa falls back to the default and only sends messages on errors.
 +
|-
 +
| AutomountDevice<br>AutomountPoint
 +
| full path
 +
| no
 +
| <none>
 +
| Device and mountpoint of backup device (e.g. USB disk). Device is automounted before a job starts and unmounted after job completion. With both properties empty no automount is done.
 +
|-
 +
| AutomountOptions
 +
| string
 +
| no
 +
| <none>
 +
| An option string passed to the mount command.
 +
|-
 +
| AutoUnmount
 +
| yes ''or'' no
 +
| no
 +
| yes
 +
| When set to 'no' the automounted device stay mounted after the Affa run.
 +
|-
 +
| Debug
 +
| yes ''or'' no
 +
| no
 +
| no
 +
| Set to yes to increase log verbosity.
 +
|-
 +
| remoteRsyncBinary
 +
| full path
 +
| no
 +
| /usr/bin/rsync
 +
| If the rsync program on the remote server is located in non-standard location, set it here
 +
|-
 +
| remoteNiceBinary
 +
| full path
 +
| no
 +
| /bin/nice
 +
| If the nice program on the remote server is located in non-standard location, set it here.
 +
|-
 +
| localRsyncBinary
 +
| full path
 +
| no
 +
| /usr/bin/rsync
 +
| If the local rsync program is located in non-standard location, set it here
 +
|-
 +
| localNiceBinary
 +
| full path
 +
| no
 +
| /bin/nice
 +
| If the nice local program is located in non-standard location, set it here.
 +
|-
 +
| RemoteAuthorizedKeysFile
 +
| path relative to remote user's home or full path
 +
| no
 +
| .ssh/authorized_keys2
 +
| If the remote host stores the authorized keys file in a non-standard location, set it here.
 +
|-
 +
| rsyncdMode
 +
| yes ''or'' no
 +
| no
 +
| no
 +
| Set to yes to connect to the rsync daemon on the remote host (instead of running rsync over ssh).
 +
|-
 +
| rsyncdModule
 +
| string
 +
| no
 +
| AFFA
 +
| The rsyncd module name (only applicable with rsyncdMode=yes).
 +
|-
 +
| rsyncdUser
 +
| string
 +
| no
 +
| affa
 +
| The username for authentication to the rsync daemon (only applicable with rsyncdMode=yes).
 +
|-
 +
| rsyncdPassword
 +
| string
 +
| no
 +
| <none>
 +
| The password for authentication to the rsync daemon (only applicable with rsyncdMode=yes).
 +
 +
|-
 +
| globalStatus
 +
| enabled ''or'' disabled ''or'' jobs
 +
| no
 +
| jobs
 +
| Set to enabled or disabled to overide the status settings in all job sections. When set to value jobs, the status settings in the job sections are effictive.<br>'''Note:''' This property is allowed only in the [GlobalAffaConfig] section.
 +
|-
 +
| sendStatus
 +
| daily ''or'' weekly ''or'' monthly ''or'' never
 +
| no
 +
| weekly
 +
| Defines how frequently the status will be sent.<br>'''Note:''' This property is allowed only in the [GlobalAffaConfig] section.
 +
|-
 +
| SMEServer
 +
| yes ''or'' no
 +
| no
 +
| no
 +
| When set to yes, the default e-smith directories are automatically included and the property RPMCheck=yes can be used.<br>'''Note:''' this property is not implemented in Affa 3 for CentOS. It has been specifically added to the fork for SME.
 +
|-
 +
| RPMCheck
 +
| yes ''or'' no
 +
| no
 +
| no
 +
| Only applicable to jobs that backup a SME server. Compares the packages installation of the source host with this affa backup host. Sends a message with diff list if not in sync. This check is useful, if you want have the option to rise the backup server to a production server from a backup.<br>'''Note:''' this property is not implemented in Affa 3 for CentOS. It has been specifically added to the fork for SME.
 +
|-
 +
| Watchdog
 +
| yes ''or'' no
 +
| no
 +
| yes
 +
| Only applicable to jobs that backups a SME server. When a job is started, affa installs a watchdog script on the source in /etc/cron.d/, which sends a warning message, if the next scheduled job (taken from the TimeSchedule property + 10 minutes) did not run. This guarantees, that you will be notfied even in case of a affa server outage. The watchdog script send a daily reminder message, if the error continues. The next run job replaces the watchdog script with a new trigger time.<br>'''Note:''' this property is not implemented in Affa 3 for CentOS. It has been specifically added to the fork for SME.
 +
|}
 +
 +
==== Default configuration properties ====
 +
For all 'name=value' properties defaults can be set in the [GlobalAffaConfig] section which are used in all job configuration when the corresponding property is omitted. For example, when these properties are set in [GlobalAffaConfig] section, they can be omitted in the specific job configurations. This is useful, when you set up many similar jobs.
 +
 +
Example: You want to set the property 'localNice' to 19 for all jobs. Then add the following section in one of your configuration files:
 +
[GlobalAffaConfig]
 +
localNice=19
 +
Consequently you don't need to set this property for your indiviual jobs. Properties set in the job record override the defaults.
 +
 +
==== Properties for global Settings ====
 +
The following special properties are only applicable to the [GlobalAffaConfig] section:
 +
<ul>
 +
<li>sendStatus</li>
 +
<li>globalStatus</li>
 +
</ul>
 +
 +
All jobs can be disabled for execution through 'cronjobs" with setting 'globalStatus' to 'disabled'.
 +
[GlobalAffaConfig]
 +
globalStatus=disabled
 +
 +
To re-enable run, either delete the above configuration line, or set to:
 +
globalStatus=jobs
 +
which is the default value.
 +
 +
You can also set the value to
 +
globalStatus=enabled
 +
which enforces the the job execution through 'cronjobs' and overrides the specified values in the section for the specific job.
 +
 
==== Smecontribs pour SME 8 ====
 
==== Smecontribs pour SME 8 ====
 
  yum install -–enablerepo=smecontribs smeserver-affa
 
  yum install -–enablerepo=smecontribs smeserver-affa
3,054

edits

Navigation menu