°Ô½Ã¹° 259°Ç
   
[redhat6.5] How can we use Amanda to backup data in Red Hat Enterprise Linux 6?
±Û¾´ÀÌ : theko ³¯Â¥ : 2017-01-11 (¼ö) 17:30 Á¶È¸ : 2771
link : https://access.redhat.com/solutions/367753



How can we use Amanda to backup data in Red Hat Enterprise Linux 6?


ȯ°æ
Red Hat Enterprise Linux 6
amsrv.example.com/amsrv 192.168.100.154 Amanda Server RHEL6.3
amcli3.example.com/amcli3 192.168.100.196 Amanda Client RHEL6.3

-Make sure the hostname is correctly configured on all the nodes.

Node amcli3  - client
[root@amcli3 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=amcli3.example.com
[root@amcli3 ~]# hostname 
amcli3.example.com

Node amsrv  - server
[root@amsrv ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=amsrv.example.com
[root@amsrv ~]# hostname 
amsrv.example.com



- Make sure /etc/hosts or DNS is correctly configured on all the nodes.
[root@amcli3 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.100.154     amsrv.example.com   amsrv
192.168.100.196     amcli3.example.com  amcli3


-Make sure yum is correctly configured on all the nodes.
Server Installation and Configuration
Install RPM package required by Amanda Server.

[root@amsrv ~]# yum install -y amanda-server amanda-client

note: amanda-client rpm is necessary for the amanda server side build.
As if the amanda-clinet rpm is not installed the amanda service will not be able to start up.

-Change setting in /etc/xinetd.d/amanda and enable this service

root@amsrv ~]# cat  /etc/xinetd.d/amanda 
# default: off
# description:  The client for the Amanda backup system.\
#               This must be on for systems being backed up\
#               by Amanda.
service amanda
{
    socket_type     = dgram
    protocol        = udp
    wait            = yes
    user            = amandabackup
    group           = disk
    server          = /usr/sbin/amandad
    server_args     = -auth=bsd amdump amindexd amidxtaped
    disable         = no
}

note: about server_args, the default is = -auth=bsd amdump, so please do not forget to edit it.

[root@amsrv ~]# chkconfig amanda on 
[root@amsrv ~]# chkconfig xinetd on 
[root@amsrv ~]# chkconfig iptables off
[root@amsrv ~]# service iptables stop
[root@amsrv ~]# service xinetd start


-Edit file /var/lib/amanda/.amandahost so amanda client can run amresotre.
[root@amsrv ~]# cat /var/lib/amanda/.amandahosts 
amcli3.example.com root amindexd amidxtaped 
amcli3   root amindexd amidxtaped

-Configure file /etc/amanda/amcli3, we can copy /etc/amanda/DailySet1 to /etc/amanda/amcli3, and change the config file due to below steps:


[root@amsrv amcli3]# cat /etc/amanda/amcli3/amanda.conf 
org      "amcli3"   
mailto   "amandabackup"            # mail address
dumpuser "amandabackup" 
inparallel 4        
dumporder "sssS"    
taperalgo first     
displayunit "k"     
netusage  8000 Kbps 
dumpcycle 4 weeks   
runspercycle 20       
tapecycle 25 tapes  
bumpsize 20 Mb      # minimum savings (threshold) to bump level 1 -> 2
bumpdays 1      # minimum days at each level
bumpmult 4      # threshold = bumpsize * bumpmult^(level-1)
etimeout 300        # number of seconds per filesystem for estimates.
dtimeout 1800       # number of idle seconds before a dump is aborted.
ctimeout 30     # maximum number of seconds that amcheck waits
device_output_buffer_size 1280k
usetimestamps yes
flush-threshold-dumped 0
flush-threshold-scheduled 0
taperflush 0
autoflush no
runtapes 2      
tpchanger "chg-disk"    
tapedev "file:///backup/amcli3" 
changerfile "/etc/amanda/amcli3/changer.conf"
changerdev "/dev/null"
maxdumpsize -1      # Maximum number of bytes the planner will schedule
tapetype HARD-DISK      # what kind of tape it is (see tapetypes below)
labelstr "^amcli3-[0-9][0-9]*$" # label constraint regex: all tapes must match
amrecover_do_fsf yes        # amrecover will call amrestore with the
amrecover_check_label yes   # amrecover will call amrestore with the
amrecover_changer "changer" # amrecover will use the changer if you restore

holdingdisk hd1 {
    comment "main holding disk"
    directory "/dumps/amcli3"   # where the holding disk is   
    use 40 Gb           # how much space can we use on it
    chunksize 1024Mb    # size of chunk if you want big dump to be
   }

infofile "/etc/amanda/amcli3/curinfo"   # database DIRECTORY
logdir   "/etc/amanda/amcli3"       # log directory
indexdir "/etc/amanda/amcli3/index"     # index directory

define dumptype global {
    comment "Global definitions"
}

define interface local {
    comment "a local disk"
    use 8000 kbps
}

define application-tool app_amgtar {
    comment "amgtar"
    plugin  "amgtar"
}

define dumptype data-tar { 
    global 
    program "GNUTAR" 
        tape_splitsize 1000 Mb
    comment "etc dumped with tar" 
    compress none 
    index yes 
    priority high

define dumptype data-dump { 
        global 
        program "DUMP" 
        comment "etc dumped with dump" 
        compress none
        index yes 
        priority low 

define tapetype HARD-DISK { 
   comment "disk-to-disk" 
   length 1024 mbytes 

define script-tool sc-email {
  comment "script-email"
  plugin  "script-email"
  execute_on pre-dle-amcheck, pre-host-amcheck, post-dle-amcheck, post-host-amcheck, pre-dle-estimate, pre-host-estimate, post-dle-estimate, post-host-estimate, pre-dle-backup, pre-host-backup, post-dle-backup, post-host-backup

  execute_where server          # or client
  property "mailto" "martinea"
}
unreserved-tcp-port 1025,65535


-Add virtual tape(harddisk tapes):

[root@amsrv ~]#  mkdir /backup/amcli3/ -p
[root@amsrv ~]#  cd /backup/amcli3
[root@amsrv amcli3]# for i in `seq 1 24` ; do mkdir slot$i; done
[root@amsrv amcli3]# chown -R amandabackup.disk /backup


-Prepare holding-disk  

[root@amsrv ~]# mkdir /dumps/amcli3 -p
[root@amsrv ~]# chown -R amandabackup.disk /dumps


- prepare index and current info.
[root@amsrv amcli3]# mkdir /etc/amanda/amcli3/curinfo/ -p
[root@amsrv amcli3]# mkdir /etc/amanda/amcli3/index/ -p
[root@amsrv amcli3]# chown -R amandabackup.disk /etc/amanda/*

- And edit filelist to choose which file/directory to backup.
[root@amsrv ~]# cat /etc/amanda/amcli3/disklist
amcli3.example.com /data1            data-tar
amcli3.example.com /dev/mapper/VolGroup-lv_home      data-dump

- Add tapelist
[root@amsrv amcli3]# touch /etc/amanda/amcli3/tapelist 
[root@amsrv amcli3]# chown amandabackup.disk /etc/amanda/amcli3/tapelist

- Set label for all tapes
[root@amsrv amcli3]# su - amandabackup 
-bash-4.1$ for i in `seq 1 9`; do /usr/sbin/amlabel amcli3 amcli3-0$i slot $i; done
-bash-4.1$ for i in `seq 10 24`; do /usr/sbin/amlabel amcli3 amcli3-$i slot $i; done

===========================================================================================

[[ Client Installation ]]
- Install RPM.

[root@amcli3 ~]# yum install -y amanda-client


- Enable service amanda and xinetd.
[root@amcli3 ~]# cat /etc/xinetd.d/amanda 
# default: off 
# description:  The client for the Amanda backup system.\ 
#               This must be on for systems being backed up\ 
#               by Amanda. 
service amanda 
    disable = no 
    socket_type     = dgram 
    protocol                = udp 
    wait            = yes 
    user            = amandabackup 
    group           = disk 
    server          = /usr/sbin/amandad 
    server_args     = -auth=bsd amdump 
[root@amcli3 ~]# chkconfig amanda on 
[root@amcli3 ~]# chkconfig xinetd on 
[root@amcli3 ~]# chkconfig iptables off
[root@amcli3 ~]# service iptables stop
[root@amcli3 ~]# service xinetd start

- Change .amandahost
[root@amcli3 ~]# cat /var/lib/amanda/.amandahosts 
amsrv.example.com       amandabackup
amsrv           amandabackup
amsrv.example.com       root
amsrv                   root


- Change /etc/amanda/amcli3/amanda-client.conf
[root@amcli3 ~]# cp -r /etc/amanda/DailySet1 /etc/amanda/amcli3 
[root@amcli3 ~]# cat /etc/amanda/amcli3/amanda-client.conf
conf "amcli3"
index_server "amsrv.example.com"    # your amindexd server
tape_server  "amsrv.example.com"    # your amidxtaped server
auth "bsd"
unreserved-tcp-port 1025,65535


= innstall end = 


= Now operation = 

Check Configuration on Amanda Server
- Check configuration, it should not report error or warning. Note it would check server configuration and try to test server-client communications.

-bash-4.1$ /usr/sbin/amcheck amcli3 
Amanda Tape Server Host Check
-----------------------------
Holding disk /dumps/amcli3: 44883968 KB disk space available, using 41943040 KB as requested
slot 24:read label `amcli3-24', date `X'.
NOTE: skipping tape-writable test
Tape amcli3-24 label ok
NOTE: host info dir /etc/amanda/amcli3/curinfo/amcli3.example.com does not exist
NOTE: it will be created on the next run.
NOTE: index dir /etc/amanda/amcli3/index/amcli3.example.com does not exist
NOTE: it will be created on the next run.
Server check took 0.773 seconds
Amanda Backup Client Hosts Check
--------------------------------
Client check: 1 host checked in 1.140 seconds.  0 problems found.
(brought to you by Amanda 2.6.1p2)


- Then please run amdump by user amandabackup

[root@amsrv ~]# su - amandabackup
-bash-4.1$ /usr/sbin/amdump amcli3

-bash-4.1$ /usr/sbin/amstatus amcli3

- With above configuration, we can find the data will be first saved into /dumps which is holding-disk, and then it would be moved to virtual tapes ( /backup/ in this case).
[root@amsrv ~]# du -s /dumps/ -h
1.4G    /dumps/

- and after somewhile we can find the data would be moved to /backup.

[root@amsrv ~]# du -s /backup/amcli3 -h
1.4G    /backup/amcli3


Restore Data
- Run this on a client by user root. This is an example to show the files and restore the file in /data1
[root@amcli3 /]# amrecover amcli3 -s amsrv -t amsrv 
AMRECOVER Version 2.6.1p2. Contacting server on amsrv.example.com ...
220 amsrv AMANDA index server (2.6.1p2) ready.
Setting restore date to today (2013-05-08)
200 Working date set to 2013-05-08.
200 Config set to amcli3.
200 Dump host set to amcli3.example.com.
Use the setdisk command to choose dump disk to recover
amrecover> listdisk
200- List of disk for host amcli3.example.com
201- /data1
201- /dev/mapper/VolGroup-lv_home
200 List of disk for host amcli3.example.com
amrecover> setdisk /data1
200 Disk set to /data1.
amrecover> ls
2013-05-08-00-43-09 file.09
2013-05-08-00-43-09 file.08
2013-05-08-00-43-09 file.07
2013-05-08-00-43-09 file.06
2013-05-08-00-43-09 file.05
2013-05-08-00-43-09 file.04
2013-05-08-00-43-09 file.03
2013-05-08-00-43-09 file.02
2013-05-08-00-43-09 file.01
2013-05-08-00-43-09 aaa.img
2013-05-08-00-43-09 aa4.img
2013-05-08-00-43-09 aa3.img
2013-05-08-00-43-09 aa.img
2013-05-08-00-43-09 00002.amcli2.example.com._data1.0
2013-05-08-00-43-09 00001.amcli2.example.com._data2.0
2013-05-08-00-43-09 00000.amcli2-09
2013-05-08-00-43-09 .
amrecover> setdisk /dev/mapper/VolGroup-lv_home
200 Disk set to /dev/mapper/VolGroup-lv_home.
amrecover> ls
2013-05-08-00-43-09 lost+found/
2013-05-08-00-43-09 .


- And then choose files to be restored.
[root@amcli3 /]# amrecover amcli3 -s amsrv -t amsrv 
AMRECOVER Version 2.6.1p2. Contacting server on amsrv.example.com ...
220 amsrv AMANDA index server (2.6.1p2) ready.
Setting restore date to today (2013-05-08)
200 Working date set to 2013-05-08.
200 Config set to amcli3.
200 Dump host set to amcli3.example.com.
Use the setdisk command to choose dump disk to recover
amrecover> setdisk /data1
200 Disk set to /data1.
amrecover> add file.09
Added file /file.09
amrecover> extract
Extracting files using tape drive changer on host amsrv.example.com.
The following tapes are needed: amcli3-24 amcli3-01
Restoring files into directory /
Continue [?/Y/n]? Y
Extracting files using tape drive changer on host amsrv.example.com.
Load tape amcli3-24 now
Continue [?/Y/n/s/d]? Y
./file.09









À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

miwit.com sir.co.kr DNS Powered by DNSEver.com DNS Powered by DNSEver.com