目前备份软件很多,但是开源云备份软件,目前接触的就是Amanda,本文主要目的是对Amanda备份软件的安装配置验证过程,只是涉及磁盘到磁盘的备份,采用虚拟两个linux操作系统,实现指定数据的备份过程,关于云端的备份,在后续研究中总结。文中有不对的地方还请各位包含。
Amanda网站提供了一篇"The 15-Minute Backup Solution"文章,本文根据该文件整理改进得到。
安装环境:
操作系统:Red Hat Enterprise Linux 6.4 64位 (安装在两个虚拟机主机名分别为:server client)下载的软件:amanda-backup_server-3.3.7-1.rhel6.x86_64.rpm(安装服务端:server) amanda-backup_client-3.3.7-1.rhel6.x86_64.rpm(安装客户端:client)
下载地址:http://www.zmanda.com/download-amanda.php
还需要安装部分软件,NFS、sharutils、gpg、xinetd。
1. rpm软件包amanda-backup_client-3.3.7-1.rhel6.x86_64.rpm
2. rpm -ivh amanda-backup_client-3.3.7-1.rhel6.x86_64.rpm
3.确保/etc/xinetd.d/amandaserver 文件内容与下述一致
#vim /etc/xinetd.d/amandaserver
# service xinetd restart
5.修改/var/lib/amanda/.amandahosts文件
# echo quartz.zmanda.com amandabackup amdump >> /var/lib/amanda/.amandahosts
# chmod 700 /var/lib/amanda/.amandahosts
6.# su amandabackup
$ chown amandabackup:disk ~amandabackup/.am_passphrase
$ chmod 700 ~amandabackup/.am_passphrase
7./usr/sbin/amcryptsimple该文件权限修改
# chown amandabackup:disk /usr/sbin/amcryptsimple
# chmod 750 /usr/sbin/amcryptsimple
服务端:安装Amanda backup server
1.rpm软件包: amanda-backup_server-3.3.7-1.rhel6.x86_64.rpm
2. rpm -ivh amanda-backup_server-3.3.3-1.rhel6.x86_64.rpm
3.确保/etc/xinetd.d/amandaserver 文件内容与下述一致
# vim /etc/xinetd.d/amandaserver
# default: on
#
# description: Amanda services for Amanda server and client.
#
service amanda
{
disable = no
flags = IPv4
socket_type = stream
protocol = tcp
wait = no
user = amandabackup
group = disk
groups = yes
server = /usr/libexec/amanda/amandad
server_args = -auth=bsdtcp amdump amindexd amidxtaped
}**一般不需要改动。
4. 重启xinetd服务
service xinetd restart
2.修改配置文件
$ vim /etc/amanda/DailySet1/amanda.conf //修改一下内容
$ amdevcheck DailySet1 //amdevcheck查检配置文件是否正确,确保返回success
SUCCESS
6.创建备份列表文件
$ vim /etc/amanda/DailySet1/disklist //该文件存储了需要备份的主机、目录和备份方式
client /home/test comp-user-tar
7.创建互相访问需要的用户名
$ vim /var/lib/amanda/.amandahosts
client root amindexd amidxtaped //确保访问client使用root用户名
server amandabackup admump //确保访问server使用amandabackup用户名
8.确认网络地址
# vim /etc/hosts //将一下内容插入该文件
192.168.60.55 server //服务端地址
192.168.60.57 client //客户端地址
$ amdump DailySet1
11. 检查执行结果
$ amadmin DailySet1 find
........ // 显示备份清单
12.指定自动运行
$ crontab -e
0 1 * * 1-5 /usr/sbin/amdump DailySet1 // 该内容插入文件,实现周一至周五每晚1点备份
备份成功!!!
客户端(client)恢复:
1.首先配置恢复文件
# vim /etc/amanda/amanda-client.conf
# amanda.conf - sample Amanda client configuration file.
#
# This file normally goes in /etc/amanda/amanda-client.conf.
#
conf "DailySet1" # your config name
index_server "server" # your amindexd server
tape_server "server" # your amidxtaped server
#tapedev "/dev/null" # your tape device //这个本实验需要注销掉
# auth - authentication scheme to use between server and client.
# Valid values are "bsd", "bsdudp", "bsdtcp" and "ssh".
# Default: [auth "bsdtcp"]
auth "bsdtcp"
# your ssh keys file if you use ssh auth
ssh_keys "/var/lib/amanda/.ssh/id_rsa_amrecover"
2.进入你要把数据恢复的目的目录处,以root身份运行amrecover
#amrecover
AMRECOVER Version 3.3.7.1p2. Contacting server on quartz.zmanda.com ...
220 quartz AMANDA index server (3.3.7.1p2) ready.
Setting restore date to today (2015-06-08)
200 Working date set to 2015-06-08.
200 Config set to DailySet1.
501 Host copper is not in your disklist.
Trying host server ...
200 Dump host set to client.
Use the setdisk command to choose dump disk to recover
amrecover> listdisk
200- List of disk for host client
201- /honme/test
200 List of disk for host client
amrecover> setdisk /honme/test
200 Disk set to /honme/test
amrecover> ls
..... //显示备份清单
amrecover> add **
. .... //增加需要恢复的目录
amrecover> extract //开始执行
.................//选择Y 就ok
amrecover> quit
200 Good bye.
恢复完成!!
listdisk ** 查看已经备份的磁盘或目录