sd运行在接受备份的机器上。配置也相当简单,只是比fd多出了一个device用于指定使
用什么硬件备份数据。可以把多个数据备份到一个device,如果是磁带机备份bacula在
恢复的时候会告诉你要使用哪个磁带。因为我使用的是文件备份的模式,所以就给每个
备份配置一个device,把不同的备份放到不同目录去,下面是一个简单文件备份device
配置
Device {
Name = dbdev
Media Type = File #这个随便写,但是在配置Director中的Storage时,必须写一
样的
Archive Device = /var/bak/db #备份到哪个目录,必须存在
LabelMedia = yes; # 自动label
Random Access = Yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
}
6,运行Director(dir)
这个配置最麻烦,因为所有配置都集中到这里,包括备份工作调度,数据库配置,fd和s
d协作配置都在这里。
Director项目的配置不说了,很简单
Client项目告诉dir去哪里找被备份机器
Client {
Name = dbfd #必须跟fd配置的名字相同
Address = 202.120.x.x
FDPort = 9102
Catalog = 225catalog #使用哪个数据库存储信息
Password = "6662f353d83dc85013690aefc00f" # 与fd配置相同即可
AutoPrune = yes # 自动清除过期的Jobs/Files
}
Storage项目告诉dir去哪里找接受备份的机器
Storage {
Name = dbsd #与sd配置相同
Address = 202.120.x.x
SDPort = 9103
Password = "6662f353d83dc85013690aefc00f"
Device = dbdev #必须在sd中存在
Media Type = File #必须与sd中相应device相同
}
Schedule项目告诉dir何时调度备份,比较独立,可以在不同的job中重用
Schedule {
Name = dbscd
Run = Level=Full mon at 7:00 #在周一7点作一次全备份
Run = Level=Full fri at 7:00 #在周五7点作一次全备份
Run = Level=Differential sat at 7:00 #在周六7点作一次差异备份
Run = Level=Differential sun at 7:00 #在周日7点作一次差异备份
Run = Level=Differential tue-thu at 7:00 #在周二到周四7点作差异备份
}
当然可以schedule还可以配置很多东西,比如增量备份以及更灵活的时间调度。可以参
考文档。
FileSet项目告诉dir应该备份什么文件,不应该备份什么文件
FileSet {
Name = dbfs
Include = compression=GZIP { #备份运行fd机器上的/var/db目录,用gzip
压缩,
/var/db/
}
Exclude = { #不包括所有的.log文件
*.log
}
}
FileSet也可以灵活配置,甚至可以在job运行时才指定备份文件
Catalog告诉dir去哪里找数据库
Catalog {
Name = dbcatalog
dbname = bacula
user = bacula
password = xxxxxxxxx
DB Address = 202.120.x.x #不要用localhost
DB Port = 3306
}
Pool告诉dir使用哪个Pool备份数据,这个概念比较搞,到配置job的时候会清晰一点。
Pool{
Name = dbpool
Pool Type = Backup
Maximum Volume Jobs = 1 #每次备份使用一个文件
Recycle = yes #重复使用
AutoPrune = yes #自动清除
Volume Retention = 15 days #备份保留时间
Maximum Volumes = 30 #最多保存多少个文件
Recycle Current Volume = yes #使用最近过期的文件存储新备份
#文件如何命名,下面的格式会产生如下的命名形式db-2004-03-19-id20
Label Format =
"db-${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}-id${JobId}"
}
Message项目告诉dir如何保存log,以及保存格式
Messages {
Name = Standard
# mailcommand = "/usr/local/bacula/bin/smtp -h 202.120.x.x -f \"\(Bacula\)
%r\
" -s \"Bacula: %t %e of %c %l\" %r"
# operatorcommand = "/usr/local/bacula/bin/smtp -h 202.120.x.x -f
\"\(Bacula\)
%r\" -s \"Bacula: Intervention needed for %j\" %r"
# mail = root@202.120.x.x = all, !skipped
# operator = root@202.120.x.x = mount
# console = all, !skipped, !saved
#
# WARNING! the following will create a file that you must cycle from
# time to time as it will grow indefinitely. However, it will
# also keep all your messages if they scroll off the console.
#
append = "/var/log/bacula.log" = all, !skipped
append ="/var/log/bacula.err.log" = error, warning, fatal
}
我保留了两份log,一份包括所有信息,一份只包括错误信息
可以看到,bacula支持把log发到邮箱中~~被我注释掉了。
Job是上面所有配置的一个组合,给用户最大的灵活性配置
Job {
Name = dbjob
Type = Backup #还有restore之类的类型,也有一些其它选项,可以实现一
些很有意思的功能
Level = Full #默认备份程度,schedule中的配置会覆盖这里的选择
Client = dbfd
FileSet = dbfs
Messages = Standard
Pool = dbpool
Storage = dbsd
Schedule = dbscd #如果没有指定schedule,默认不运行,可以通过console
调度
}
还有一个counter的配置。。不配置他也能运行,不说了
7,console运行
console是你动态管理bacula的窗口,配置很简单。运行console可以实现很多很有价值
的管理活动。具体可以参考文档说明。
8,让整个系统运行。
没什么好说的,只要配置正确,就没有什么挫折。不能正常运行就去看看log,bacula的
log非常详细。
9,性能和稳定性。
性能不错,瓶颈明显在带宽,cpu占用不高(不使用gizp)。稳定性尚不清楚,据作者说
非常好。稳定运行一年半载不成问题。
10,有趣的工作。
用bacula你可以实现一个额外的功能,类似tripwire文件系统检查机制。具体看文档。
我说了很多具体看文档~~~~bacula的文档确实很不错,很翔实,如果你需要借重他来备
份,多看看不会错。
11,the end
