Installazione e configurazione Amanda su Debian: Difference between revisions
mNo edit summary |
|||
| Line 36: | Line 36: | ||
<pre> | <pre> | ||
org "Customername" | org "Customername host" # your organization name for reports | ||
dumpcycle 4 weeks # the number of days in the normal dump cycle | dumpcycle 4 weeks # the number of days in the normal dump cycle | ||
| Line 59: | Line 58: | ||
indexdir "/var/lib/amanda/DailySet1/index" # index directory | indexdir "/var/lib/amanda/DailySet1/index" # index directory | ||
tapelist "/etc/amanda/DailySet1/tapelist" # list of used tapes | tapelist "/etc/amanda/DailySet1/tapelist" # list of used tapes | ||
includefile "/etc/amanda/tapetypes.conf" | |||
includefile "/etc/amanda/dumptypes.conf" | |||
</pre> | </pre> | ||
| Line 69: | Line 71: | ||
sudo -u backup touch /etc/amanda/DailySet1/tapelist | sudo -u backup touch /etc/amanda/DailySet1/tapelist | ||
</pre> | </pre> | ||
* Definire l'alias a cui inviare i report | |||
sudoedit /etc/aliases | |||
backup backupreport@domain.dom | |||
sudo newaliases | |||
sudo invoke-rc.d postfix reload | |||
== Definizione del tipo di nastro == | == Definizione del tipo di nastro == | ||
| Line 86: | Line 96: | ||
Verificare che non sia già esistente nel file di configurazione. | Verificare che non sia già esistente nel file di configurazione. | ||
Se non esiste, cercarlo nelle FAQ di amanda http://amanda.sourceforge.net/cgi-bin/fom?cmd=searchForm&file=1 oppure su google. | Se non esiste, cercarlo nelle FAQ di amanda http://amanda.sourceforge.net/cgi-bin/fom?cmd=searchForm&file=1 oppure su google. | ||
Esempi: | Esempi: | ||
Revision as of 08:36, 26 November 2010
Installazione pacchetti
sudo aptitude install amanda-server amanda-client
Riavviare inetd:
sudo invoke-rc.d openbsd-inetd restart
Configurazione dell'accesso alla macchina da backuppare
- Se la macchina da backuppare è la stessa su cui si installa tutto, aggiungere la seguente riga, altrimenti il processo server di backup non riuscirà a collegarsi:
sudoedit /etc/amandahosts
#host.domain.dom user services localhost backup galvirt01.galimberti.priv backup # User backup makes backup galvirt01.galimberti.priv root amindexd amidxtaped #user root must do restores too
Preparazione files di configurazione
Copiare il file di configurazione standard:
sudo mkdir /etc/amanda/DailySet1 zcat /usr/share/doc/amanda-common/examples/amanda.conf.gz | sudo tee /etc/amanda/DailySet1/amanda.conf > /dev/null sudo chown -R backup.backup /etc/amanda/ sudo chmod a+rX /etc/amanda
Modificare quanto segue
sudoedit /etc/amanda/DailySet1/amanda.conf
org "Customername host" # your organization name for reports
dumpcycle 4 weeks # the number of days in the normal dump cycle
runspercycle 24 # the number of amdump runs in dumpcycle days
# 4 weeks * 6 amdump runs per week (Mon to Sat)
tapecycle 26 tapes # the number of tapes in rotation
# 4 weeks (dumpcycle) times 6 tapes per week (Mon
# to Sat) plus a few to handle errors that
# need amflush and so we do not overwrite the full
# backups performed at the beginning of the previous
# cycle
tapedev "/dev/nst0" # Linux @ tuck, important: norewinding
#tpchanger "chg-manual" # the tape-changer glue script
#changerfile "/etc/amanda/DailySet1/changer.conf"
#changerdev "/dev/null"
...
infofile "/var/lib//amanda/DailySet1/curinfo" # database DIRECTORY
logdir "/var/lib/amanda/DailySet1/logdir" # log directory
indexdir "/var/lib/amanda/DailySet1/index" # index directory
tapelist "/etc/amanda/DailySet1/tapelist" # list of used tapes
includefile "/etc/amanda/tapetypes.conf"
includefile "/etc/amanda/dumptypes.conf"
- Creare le directory per il database, i log e quant'altro:
sudo -u backup mkdir /var/lib/amanda/DailySet1 sudo -u backup mkdir /var/lib/amanda/DailySet1/logdir sudo -u backup mkdir /var/lib/amanda/DailySet1/curinfo sudo -u backup mkdir /var/lib/amanda/DailySet1/index sudo -u backup touch /etc/amanda/DailySet1/tapelist
- Definire l'alias a cui inviare i report
sudoedit /etc/aliases backup backupreport@domain.dom
sudo newaliases sudo invoke-rc.d postfix reload
Definizione del tipo di nastro
Bisogna definire un tipo nastro, da utilizzare poi nella configurazione.
Identificare il tape drive in uso:
# cat /proc/scsi/scsi Attached devices: Host: scsi0 Channel: 00 Id: 03 Lun: 00 Vendor: HP Model: C5683A Rev: C104 Type: Sequential-Access ANSI SCSI revision: 02
Verificare che non sia già esistente nel file di configurazione. Se non esiste, cercarlo nelle FAQ di amanda http://amanda.sourceforge.net/cgi-bin/fom?cmd=searchForm&file=1 oppure su google.
Esempi:
HP Dat 8i C1533A
4 Gb non compressi DDS2
define tapetype C1533A_120 {
comment "HP C1533A DDS2 with 120m tapes"
length 3858 mbytes
filemark 107 kbytes
speed 507 kbytes
}
HP Dat 40i C5683A
20 Gb non compressi DDS4
define tapetype HP-Dat-40-C5683A {
comment "HP Surestore Dat40i C5683A"
length 19560 mbytes
filemark 1147 kbytes
speed 2957 kps
}
HP Dat 160
define tapetype HP-DAT160 {
comment "HP StorageWorks DAT 160)"
length 78236 mbytes
filemark 4461 kbytes
speed 6272 kps
}
Mettere la definizione che interessa prima delle altre.
- Inserire la definizione:
tapetype HP-Dat-40-C5683A
Definizione del Formato della Label per i nastri
Occorre definire un formato standard per verificare che il tape inserito sia effettivamente uno giusto.
Per standard utilizziamo il formato
A-01-MON
sudoedit /etc/amanada/DailySet1/amanda.conf labelstr "^[A-Z]-0[0-5]-[MON|TUE|WED|THU|FRI|SAT]" # label constraint regex: all tapes must match
Definizione del tipo di Job di Backup
Occorre definire le caratteristiche del dumptype.
Utilizziamo un backup completo giornaliero che utilizzi il formato portabile tar compresso, includendo delle esclusioni di default.
sudoedit /etc/amanada/DailySet1/amanda.conf
define dumptype always-full {
comment "Full dump using tar with best software compression"
program "GNUTAR"
compress server best
index
priority high
dumpcycle 0
exclude append "./files/amanda-holding"
exclude append "./dev/log"
exclude append "./tmp/*"
exclude append "./var/lib/amavis/amavis-*"
exclude append "./var/lib/amavis/tmp"
exclude append "./var/lib/backuppc"
exclude append "./var/run/acpid.socket"
exclude append "./var/run/clamav/clamd.ctl"
exclude append "./var/run/courier/authdaemon/socket"
exclude append "./var/run/cups/cups.sock"
exclude append "./var/run/dbus/system_bus_socket"
exclude append "./var/run/gcache_port"
exclude append "./var/run/mysqld/mysqld.sock"
exclude append "./var/run/samba/winbindd_privileged/pipe"
exclude append "./var/run/saslauthd/mux"
exclude append "./var/spool/postfix/defer"
exclude append "./var/spool/postfix/deferred"
exclude append "./var/spool/postfix/private/amavis"
exclude append "./var/spool/postfix/private/anvil"
exclude append "./var/spool/postfix/private/bounce"
exclude append "./var/spool/postfix/private/bsmtp"
exclude append "./var/spool/postfix/private/defer"
exclude append "./var/spool/postfix/private/discard"
exclude append "./var/spool/postfix/private/error"
exclude append "./var/spool/postfix/private/ifmail"
exclude append "./var/spool/postfix/private/lmtp"
exclude append "./var/spool/postfix/private/local"
exclude append "./var/spool/postfix/private/maildrop"
exclude append "./var/spool/postfix/private/mailman"
exclude append "./var/spool/postfix/private/odmr"
exclude append "./var/spool/postfix/private/proxymap"
exclude append "./var/spool/postfix/private/relay"
exclude append "./var/spool/postfix/private/rewrite"
exclude append "./var/spool/postfix/private/scache"
exclude append "./var/spool/postfix/private/scalemail-backend"
exclude append "./var/spool/postfix/private/smtp"
exclude append "./var/spool/postfix/private/tlsmgr"
exclude append "./var/spool/postfix/private/trace"
exclude append "./var/spool/postfix/private/uucp"
exclude append "./var/spool/postfix/private/verify"
exclude append "./var/spool/postfix/private/virtual"
exclude append "./var/spool/postfix/public/cleanup"
exclude append "./var/spool/postfix/public/flush"
exclude append "./var/spool/postfix/public/showq"
exclude append "./var/spool/squid"
}
Il dumptype sarà poi assegnato ad ogni disco in seguito.
Definizione dei dischi da backuppare
Occorre definire che dischi backuppare e in che modo.
sudoedit /etc/amanda/DailySet1/disklist
# File format is: # hostname mountpoint dumptype # where the dumptypes are defined by you in amanda.conf. #nomeserver mountpint dumptype #server /bin always-full server / always-full
Preparazione dell'Holding Disk
Per velocizzare ed ottimizzare la scrittura su nastro, utilizzare un holding disk.
Testare:
sudo -u backup amcheck -c -l DailySet1
Amanda Tape Server Host Check ----------------------------- Holding disk /files/space/amanda-holding: 208263128 KB disk space available, using 206165976 KB
Test della configurazione
- Testare la configurazione:
sudo -u backup amcheck -c -l DailySet1
Darà vari errori, ma quello che interessa a noi è:
Amanda Backup Client Hosts Check -------------------------------- Client check: 1 host checked in 0.243 seconds, 0 problems found
Etichettatura dei nastri
- Ritestare:
sudo -u backup amcheck DailySet1
Backup di prova
- Impostare in disklist un job di backup di test:
sudo cp /etc/amanda/DailySet1/disklist /etc/amanda/DailySet1/disklist.production sudoedit /etc/amanda/DailySet1/disklist
server /usr/share always-full
- Testare
sudo -u backup amcheck -w DailySet1
- Impostare un nome descrittivo per l'utente backup:
sudo chfn -f "Backup SERVERNAME" backup
- Controllare che l'utente backup possa mandare email:
echo test | sudo -u backup mail -s test myaddress@domain.dom
- Lanciare il backup di test:
sudo -u backup amdump DailySet1
- Controllarne l'avanzamento
sudo -u backup watch amstatus DailySet1
- Verificare il nastro:
sudo -u backup amverify DailySet1
- Se è ok, reimpostare la disklist di partenza
sudo cp /etc/amanda/DailySet1/disklist /etc/amanda/DailySet1/disklist.test sudo cp /etc/amanda/DailySet1/disklist.production /etc/amanda/DailySet1/disklist
Test di restore
- Creare la directory in cui verranno salvati i fire del restore
mkdir /tmp/amrecover
- Avviare amrecover:
sudo amrecover -C DailySet1 -s galvirt01 -t galvirt01 -d /dev/nst0
AMRECOVER Version 2.5.2p1. Contacting server on galvirt01 ... 220 galvirt01 AMANDA index server (2.5.2p1) ready. Setting restore date to today (2009-07-28) 200 Working date set to 2009-07-28. 200 Config set to DailySet1. 200 Dump host set to galvirt01. Use the setdisk command to choose dump disk to recover
amrecover> listdisk
200- List of disk for host galvirt01 201- /usr/share 200 List of disk for host galvirt01
amrecover> setdisk /usr/share
200 Disk set to /usr/share.
amrecover> history
200- Dump history for config "DailySet1" host "galvirt01" disk /usr/share 201- 2009-07-28-15-47-17 0 C-6-SAT:1 200 Dump history for config "DailySet1" host "galvirt01" disk /usr/share
amrecover> setdate 2009-07-28
200 Working date set to 2009-07-28.
amrecover> lcd /tmp/amrecover
amrecover> add *
Added dir /zoneinfo/ at date 2009-07-28-15-47-17 ... Added dir /X11/ at date 2009-07-28-15-47-17
amrecover> extract
Extracting files using tape drive /dev/nst0 on host galvirt01. The following tapes are needed: C-6-SAT Restoring files into directory /tmp
Continue [?/Y/n]? y
Extracting files using tape drive /dev/nst0 on host galvirt01. Load tape C-6-SAT now
Continue [?/Y/n/s/t]? y
./X11/ ./X11/doc/ ... ./zoneinfo/right/US/Samoa
amrecover> quit
200 Good bye.
ls /tmp/amrecover
Schedulazione
- Creare lo script wrapper che esegue il backup ed espelle il nastro:
cat | sudo tee /usr/local/sbin/amanda-DailySet1 > /dev/null <<EOFile #!/bin/bash # Run Daily Backup /usr/sbin/amdump DailySet1 /usr/sbin/ammt -f /dev/st0 rewoffl EOFile
sudo chmod +x /usr/local/sbin/amanda-DailySet1
- Impostare il seguente crontab per lo user backup
- check del nastro la mattina ed il pomeriggio
- backup la sera da LUN-SAB
cat | sudo -u backup crontab - <<EOFile # Check if Daily Tape is inserted, Mon-Sat 0 11 * * 1-6 /usr/sbin/amcheck -m -w DailySet1 0 17 * * 1-5 /usr/sbin/amcheck -m -w DailySet1 # Run Daily Backup, Mon-Sat 5 22 * * 1-6 /usr/local/sbin/amanda-DailySet1 EOFile
- Controllare:
sudo -u backup crontab -l
- Impostare le eventuali esclusioni specifiche per il sistema in uso.