Bacula 配置(conf)

技术分享 Story 105浏览 0评论
摘要

Bacula 配置(conf)

Storage Daemon(sd)
Bacula-sd.conf
Device {
 Name = dbdev  #在配置Director中的Storage时,必须写相同的
 Media Type = File 
 Archive Device = /var/bak/db #备份到哪个目录,必须存在
 LabelMedia = yes;          # 自动label
 Random Access = Yes;
 AutomaticMount = yes;        #
when device opened, read it
 RemovableMedia = no;
 AlwaysOpen = no;
}

Director(dir)
Bacula-dir.conf
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点作差异备份
}
FileSet项目告诉dir应该备份什么文档,不应该备份什么文档:
FileSet {
    Name = dbfs
    Include = compression=GZIP { #备份运行fd机器上的/var/db目录,用gzip
压缩,
        /var/db/
    }
    Exclude = { #不包括任何的.log文档
        *.log
    }
}
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 #错误日志
}

Job是上面任何配置的一个组合,给用户最大的灵活性配置(最重要):
Job {
    Name = dbjob
    Type = Backup  #更有restore之类的类型,也有一些其他选项.
    Level =
Full  #默认备份程度,schedule中的配置会覆盖这里的选择
    Client = dbfd
    FileSet = dbfs
    Messages = Standard
    Pool = dbpool
    Storage = dbsd
    Schedule = dbscd #假如没有指定schedule,默认不运行,能够通过console调度
}
FileSet Examples:
FileSet {
  Name = "Full Set"             #全备份
  Include {
    Options {
      Compression=GZIP        #被压缩成GZIP格式
      signature=SHA1          #这个不是很清楚,需要再看看NND
      Sparse = yes
    }
    @/etc/backup.list            #这个目录里的任何文档
  }
  Include {
     Options {
        wildfile = "*.o"          #匹配文档名以“.o”结尾的文档   
        wildfile = "*.exe"        #匹配文档名以“.exe”结尾的
        Exclude = yes           #排除以上匹配的文档
     }
     File = /root/myfile           #备份目录 /root/myfile
     File = /usr/lib/another_file     #备份目录 /usr/lib/another_file
  }
  Exclude {
     File = /tmp                #不备份/tmp目录
  }
}
#END  周详的配置,请查看bacula文档

转载请注明:成长的对话 » Bacula 配置(conf)