📄 howto
字号:
--------------------------------------------------------------------------17: How to use built-in compression ?The distribution must be built selecting the appropriateoptions to link the zlib functions in. When using the Installscript you are asked for the required information. Otherwisesee the file INSTALL for details.The zlib version 1.0.2 or higher is required to build thepackage with the built-in compression feature. If the zlib is notavailable on your system (on Linux it is usually installed bydefault), get it from some ftp server and build it first beforeattempting to build afbackup.The new clientside configuration parameter BuiltinCompressLevelturns on built-in compression. See FAQ Q27, what to do when thecompression algorithm is to be changed.--------------------------------------------------------------------------18: How to save database contents ?There are several ways to save a database. Which to choose,depends on the properties of the database software. Thesimplest way is to1.) Save the directory containing the database filesThis assumes, that the database stores the data in normalfiles somewhere in the directory structure. Then thesefiles can be written to tape. But there is a problem here,cause the database software might make use of caching orgenerally keep necessary information in memory as long assome database process is running. Then just saving thefiles and later restoring them will quite sure corrupt thedatabase structure and at least make some (probably longrunning) checks necessary, if not make the data unusable.Thus it is necessary to shut down the database beforesaving the files. This is often unacceptable, cause userscan not use the database while it is not running. Consultthe documentation of your database, whether it can besaved or dumped online and read on.2.) Save the raw deviceThis assumes, that the database software stores the dataon some kind of raw device, maybe a disk partition, a solidstate disk or whatever. Then it can be saved prefixing thename with /../, no space between the prefix and the rawdevice name. Instead of /../ the option -r can be used inthe client side configuration file. By default the data isnot compressed, because one single wrong bit in the saveddata stream might make the whole rest of the data streamunusable during uncompression. If compression is nonethelessdesired, the prefix //../ can be used or the option -R .For online/offline issues the same applies here, as if thedata were kept in normal files.3.) Save the output of a dump commandIf your database has a command to dump all it's contents,it can be used to directly save the output of this commandto the backup. In the best case, this dump command and it'scounterpart, who reads, what the dump command has writtenand thus restores the whole database or parts of it, is ableto do the job online without shutting down the database.Such a pair of commands can be supplied in the client sideconfiguration file as follows: In double quotes, write atriple bar ||| , followed by a space character and the dumpcommand. This may be a shell command, maybe a command pipeor sequence or whatever. Then another triple bar must bewritten, followed by the counterpart of the dump command(also any shell-style command is allowed). After all that,an optional comment may follow, prefixed with a triplesharp ###. Example: ||| pg_dumpall ||| psql db_tmpl ### Store Postgres DBs--------------------------------------------------------------------------19: How to use the ftape driver ?There's nothing very special here. All mt commands in theserver side configuration must be replaced with appropriateftmt versions. The script __mt should be obsolete here, asit only handles the special case when the count value is 0e.g. for skipping tape files with mt fsf <count> . ftmtshould be able to handle count=0, so simply replace __mtwith ftmt in the default configuration. For the tape device,supply /dev/nqftX with X being the appropriate serial numberassigned to the device by your OS (ls /dev/nqft* will tellall available devices, try ftmt ... to find out the correctone).--------------------------------------------------------------------------20: How to move a cartridge to another set due to it's usage count ?This can be done automatically configuring an appropriateprogram as Tape-Full-Command on the server side. An examplescript has been provided and installed with the distribution.It can be found as /path/to/server/bin/cartagehandler. As is,it maintains 3 cartridge sets. If a tape has become full morethan 80 times and it is in set 1, it is moved to set 2. Ifit became full more than 90 times and it is in set 1 or 2,it is moved to set 3. If the number of cycles exceeds 95, thecartridge is removed from all sets.To accomplish this task, the script gets 3 arguments:The number of the cartridge currently getting full, the numberof it`s complete write cycles up to now and the full path tothe serverside configuration file, which is modified by thescript. If the Tape-Full-Command is configured like this: TapeFull-Command: /path/to/server/bin/cartagehandler %c %n %Cthen it will do the job as expected. Feel free to modify thisscript to fit your needs. The comments inside should be helpful.Look for "User configured section" and the like in the comments.This script is not overwritten, when upgrading i.e. installinganother version of afbackup. Please note, that the configurationfile must be writable for the user, under whose id the serverstarts. The best way is to make the configuration file be ownedby this user.See also the documentation for the program __numset, it's veryhelpful in this context.--------------------------------------------------------------------------21: How to make backups to different cartridge sets by type or by date ?Sometimes people want to make the incremental backups to other setsof cartridges than the full backups. Or they want to change thecartridge set weekly. Here the normal cartridge set mechanisms canbe used (client side option -S). If the difference is the type(full or incremental), the -S can be hardcoded into the crontabentry. If the difference is the date, a little simple script canhelp. If e.g. in even weeks the backup should go to set 1 and inodd weeks to set 2 the following script conveys the appropriateset number, when called:#!/bin/shexpr '(' `date +%W` % 2 ')' + 1This script can be called within the crontab entry. Typical crontabentries will thus look as follows, assuming the script is calledas /path/to/oddevenweek:# full backup starting Friday evening at 10 PM0 22 * * 5 /path/to/client/bin/full_backup -d -S `/path/to/oddevenweek`# incremental backup starting Monday - Thursday at 10 PM0 22 * * 1-4 /path/to/client/bin/incr_backup -d -S `/path/to/oddevenweek`--------------------------------------------------------------------------22: How to achieve independence from the machine names ?- Use a host alias for the backup server and use this name in the clients' configuration files. Thus, if the server changes, only the hostname alias must be changed to address the new server- Configure a ServerIdentifier, e.g. reflecting the hostname alias on the server side- Use the client identifiers in the clientside configuration files. Set them to strings, that can easily be rememberedNotes:Performing the steps above no hostname should appear in any indexfile, minimum restore info or other varying status informationfiles any more.If now the server changes, the server identifier must be set tothe value the other server had before and the client will accepthim after contacting. To contact the correct server the clientconfigurations would have to be changed to the new hostname. Herethe hostname alias serves for making things easier. No clientconfiguration must be touched, just the hostname alias assignedto a different real hostname in NIS or whatever nameservice isused.If restore should go to a different client, the identifier of theoriginal client, the files have been saved from, must be suppliedto get the desired files back. Option -W will be used in most cases.--------------------------------------------------------------------------23: How to restrict the access to cartridges for certain clients ?Access can restricted on a cartridge set base. For each cartridgeset a check can be configured, whether a client has access to itor not. Refer to the afserver.conf manual page under Cartridge-Setshow to specify the desired restrictions.--------------------------------------------------------------------------24: How to recover from disaster (everything is lost) ?There are several stages to recover. First for the client side:* Only the data is lost, afbackup installation and indexes are still in placeNothing special here. To avoid searching the index the -a option ofafrestore is recommended. Instead, afrestore '*' can be used, butthis will search the index and might take longer.* Data, afbackup installation and indexes are gone, minimum restore information is availableInstall afbackup from whatever source. Then run afrestore -e. If youhaven't configured afbackup after installing, pass the client's uniqueidentifier to the program using the option -W. After pressing <Return>to start the command, you are expected to enter the minimum restoreinfo. It is necessary, that it is typed in literally like written bythe backup system. The easiest way is to cut and paste. The line, thatis containing this information needs not to be the first one enteredand there may be several lines of the expected format, also from otherclients (the client identifier is part of the minimum restore info).The lastest available one from the input and coming from the clientwith the given or configured identifier will be picked and used. Thusthe easiest way to use the option -e is to read from a file containingthe expected information. If you have forgotten the identifier of thecrashed client, look through your minimum restore infos to find it.To restore only the indexes use option -f instead of -e.* Data, afbackup installation and indexes are gone, minimum restore information is also lostFind out, which tape(s) has been written to the last time the backupsucceeded for the crashed client. Possibly see the mails sent by theExitProgram for more information about this. Install afbackup on theclient. Now run afrestore with option -E, pass it the client identifierwith option -W and one or more tape specifiers with the hostname andport number (if it's not the default) of the server, where the clientdid it's backup to. Examples: afrestore -E -W teefix 3@backupserver%3002 afrestore -E -W my-ID 4-6,9@buhost%backupsrv afrestore -E -W c3po.foodomain.org 3@buserv 2@buservThe third example will scan tapes 3 and 2 on the server buserv usingthe default TCP-service to retrieve the minimum restore information.The first will scan tape 3 on host backupserver, using port number3002 (TCP). The second one will scan tapes 4 through 6 and 9 on theserver buhost connecting the TCP-service backupsrv. This name mustbe resolvable from /etc/services, NIS or similar. Otherwise thiscommand will not work.While scanning the tapes all found minimum restore informations (forany client) will be output, so another one than the one with thelatest timestamp can be used later with option -e. If only the tapesshould be scanned for minimum restore informations without restoringeverything afterwards, option -l can be supplied. Then operation willterminate having scanned all the given tapes and having printed allfound minimum restore informations.For the server side:The var-directory of the server is crucial for operation, so it isheavily recommended to save it, too (see below under Do-s and Dont-s).The afbackup system itself can be installed from the latest sourcesafter a crash.To get the var-directory back, run afrestore -E or -e, depending onthe availability of the minimum restore information, as explainedabove, and pass it a directory to relocate the recovered files. Thenmake sure, that no afserver process is running anymore (kill them,if they don't terminate voluntarily), and move all files from therecovered and relocated var-directory to the one, that is reallyused by the server. If you are doing this as root, don't forget tochown the files to the userid, with that the afbackup server isstarted. If the server's var directory has been stored separatelyas explained in Do-Dont, the different client-ID must be supplied tothe afrestore command using the options -W like when having run thefull_backup, e.g. afrestore -E -W serv-var -V /tmp/foo -C /tmp/servvar 2@backuphost%backupportThe directory /tmp/foo must exist and can be removed afterwards.See the man-pages of afrestore for details of the -E mode.--------------------------------------------------------------------------25: How to label a tape, while the server is waiting for a tape ?Start the program label_tape with the desired options, furthermoresupplying the option -F, but without option -f. Wait for the programto ask you for confirmation. Do not confirm now, first put the tape,you want to label, into the drive. (The server does not perform anytape operation, while the label_tape program is running) Now enteryes to proceed. If the label is the one expected by the server andthe server is configured to probe the tape automatically, it willimmediately use it, otherwise eject the cartridge.--------------------------------------------------------------------------26: How to use a media changer ?
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -