Storage {}为主控端定义了存储端的属性。至少存在一个存储端。
Name = name 指定Storage {}名称,必选。 |
Address = address 指定存储端的地址,可以是IP或者计算机名,如果选择计算机名,必须在/etc/hosts文件中加入解析条目,让系统能解析到此计算机名。必选。 |
SD Port = port 指定存储端的端口号,默认为9103。 |
Password = password 指定存储端的密码。出于安全原因,最好设置复杂密码,必选。 |
Device = device-name 指定存储的设备。引用存储端配置文件的Device{}的Name值,必选。 |
Media Type = MediaType 与存储端配置文件的Device{}的Media Type值相同,必选。详见官方文档。 |
Autochanger = yesno 默认为no,详见官方文档。 |
Maximum Concurrent Jobs = number 定义此存储端所允许同时进行的任务最大数量,默认为1。 |
AllowCompression = yesno 此存储端是否允许压缩,默认为yes,此参数可选。如果为no,那么将忽略Fileset{}中Options{}的compression参数。 |
Heartbeat Interval = time-interval 默认为0,可选。 |
范例
Storage {
Name = File
# Do not use "localhost" here
Address = ser1 # N.B. Use a fully qualified name here
SDPort = 9103
Password = "222"
Device = FileStorage
Media Type = File
}
Name = name |
指定Catalog{}名称,必选。 |
password = password |
指定数据库密码 |
DB Name = name |
指定数据库名称 |
user = user |
指定数据库用户 |
DB Address = address |
指定数据库地址 |
DB Port = port |
指定数据库端口号 |
范例
Catalog {
Name = MyCatalog
# Uncomment the following line if you want the dbi driver
# dbdriver = "dbi:mysql"; dbaddress = 127.0.0.1; dbport =
dbname = "bacula"; dbuser = "bacula"; dbpassword = ""
}
Name = name |
指定Messages{}名称,必选。 |
MailCommand = command |
设置发送邮件通知的指令 |
OperatorCommand = command |
默认值 |
范例
Messages {
Name = Standard
mailcommand = "/usr/local/bacula/bin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r"
operatorcommand = "/usr/local/bacula/bin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: Intervention needed for %j\" %r"
mail = root@localhost = all, !skipped
operator = root@localhost = mount
console = all, !skipped, !saved
append = "/usr/local/bacula/working/log" = all, !skipped
catalog = all
}
Name = name |
指定Pool{}名称,必选。 |
Pool Type = type |
指定Pool{}类型。 |
Storage = storage-resource-name |
引用Storage {}的Name值 |
AutoPrune = yesno |
是否自动修剪 |
Volume Retention = time-period-specification |
Volume保留时间,默认为1年。 |
Recycle = yesno |
是否重复使用Volume |
范例
Pool {
Name = Default
Pool Type = Backup
Recycle = yes # Bacula can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 365 days # one year
}
此选项一般设置托盘监控相关参数
Name = name |
指定Console{}名称,必选。 |
Password = password |
指定Console{}密码,必选。 |
CommandACL = name-list |
默认值 |
范例
Console {
Name = ser1-mon
Password = "444"
CommandACL = status, .status
}
#
# Default Bacula Director Configuration file
#
# The only thing that MUST be changed is to add one or more
# file or directory names in the Include directive of the
# FileSet resource.
#
# For Bacula release 5.0.1 (24 February 2010) -- redhat
#
# You might also want to change the default email address
# from root to your address. See the "mail" and "operator"
# directives in the Messages resource.
#
Director { # define myself
Name = ser1-dir
DIRport = 9101 # where we listen for UA connections
QueryFile = "/usr/local/bacula/bin/query.sql"
WorkingDirectory = "/usr/local/bacula/working"
PidDirectory = "/usr/local/bacula/bin/working"
Maximum Concurrent Jobs = 1
Password = "111" # Console password
Messages = Daemon
}
JobDefs {
Name = "DefaultJob"
Type = Backup
Level = Incremental
Client = ser1-fd
FileSet = "Full Set"
Schedule = "WeeklyCycle"
Storage = File
Messages = Standard
Pool = File
Priority = 10
Write Bootstrap = "/usr/local/bacula/working/%c.bsr"
}
#
# Define the main nightly save backup job
# By default, this job will back up to disk in /tmp
Job {
Name = "BackupClient1"
JobDefs = "DefaultJob"
}
#Job {
# Name = "BackupClient2"
# Client = ser12-fd
# JobDefs = "DefaultJob"
#}
# Backup the catalog database (after the nightly save)
Job {
Name = "BackupCatalog"
JobDefs = "DefaultJob"
Level = Full
FileSet="Catalog"
Schedule = "WeeklyCycleAfterBackup"
# This creates an ASCII copy of the catalog
# Arguments to make_catalog_backup.pl are:
# make_catalog_backup.pl <catalog-name>
RunBeforeJob = "/usr/local/bacula/bin/make_catalog_backup.pl MyCatalog"
# This deletes the copy of the catalog
RunAfterJob = "/usr/local/bacula/bin/delete_catalog_backup"
Write Bootstrap = "/usr/local/bacula/working/%n.bsr"
Priority = 11 # run after main backup
}
#
# Standard Restore template, to be changed by Console program
# Only one such job is needed for all Jobs/Clients/Storage ...
#
Job {
Name = "RestoreFiles"
Type = Restore
Client=ser1-fd
FileSet="Full Set"
Storage = File
Pool = Default
Messages = Standard
Where = /tmp/bacula-restores
}
#localhost
Job {
Name = "ser1-backup"
Type = Backup
Level = Full
Client = ser1-fd
FileSet = "ser1-backup"
Messages = Standard
Pool = client-pool
Storage = File
Schedule = "OneDay"
Priority = 10
Write Bootstrap = "/usr/local/bacula/working/ser1-backup.bsr"
}
Job {
Name = "ser1-restore"
Type = Restore
Client = ser1-fd
FileSet = "ser1-backup"
Storage = File
Pool = client-pool
Messages = Standard
Where = /opt/restore
Bootstrap = "/usr/local/bacula/working/ser1-backup.bsr"
}
#redhat
Job {
Name = "redhat-backup"
Type = Backup
Level = Full
Client = redhat-fd
FileSet = "redhat-backup"
Messages = Standard
Pool = client-pool
Storage = File
Schedule = "OneDay"
Priority = 10
Write Bootstrap = "/usr/local/bacula/working/redhat-backup.bsr"
}
Job {
Name = "redhat-restore"
Type = Restore
Client = redhat-fd
FileSet = "redhat-backup"
Storage = File
Pool = client-pool
Messages = Standard
Where = /opt/restore
Bootstrap = "/usr/local/bacula/working/redhat-backup.bsr"
}
#sen-lenovo
Job {
Name = "sen-lenovo-backup"
Type = Backup
Level = Full
Client = sen-lenovo-fd
FileSet = "sen-lenovo-backup"
Messages = Standard
Pool = client-pool
Storage = File
Schedule = "OneDay"
Priority = 10
Write Bootstrap = "/usr/local/bacula/working/sen-lenovo-backup.bsr"
}
Job {
Name = "sen-lenovo-restore"
Type = Restore
Client = sen-lenovo-fd
FileSet = "sen-lenovo-backup"
Storage = File
Pool = client-pool
Messages = Standard
Where = /opt/restore
Bootstrap = "/usr/local/bacula/working/sen-lenovo-backup.bsr"
}
# List of files to be backed up
FileSet {
Name = "Full Set"
Include {
Options {
signature = MD5
}
File = /usr/local/bacula/bin
}
Exclude {
File = /usr/local/bacula/working
File = /tmp
File = /proc
File = /tmp
File = /.journal
File = /.fsck
}
}
#
# When to do the backups, full backup on first sunday of the month,
# differential (i.e. incremental since full) every other sunday,
# and incremental backups other days
Schedule {
Name = "WeeklyCycle"
Run = Full 1st sun at 23:05
Run = Differential 2nd-5th sun at 23:05
Run = Incremental mon-sat at 23:05
}
# This schedule does the catalog. It starts after the WeeklyCycle
Schedule {
Name = "WeeklyCycleAfterBackup"
Run = Full sun-sat at 23:10
}
# one day
Schedule {
Name = "OneDay"
Run = Level=Full daily at 18:18
}
# This is the backup of the catalog
FileSet {
Name = "Catalog"
Include {
Options {
signature = MD5
}
File = "/usr/local/bacula/working/bacula.sql"
}
}
#localhost
FileSet {
Name = "ser1-backup"
Include {
Options {
compression=GZIP
}
File = /ser1
}
}
#redhat
FileSet {
Name = "redhat-backup"
Include {
Options {
compression=GZIP
}
File = /redhat
}
}
#sen-lenovo
FileSet {
Name = "sen-lenovo-backup"
Include {
Options {
compression=GZIP
}
File = c:/sen-lenovo/
}
}
# Client (File Services) to backup
#ser1
Client {
Name = ser1-fd
Address = ser1
FDPort = 9102
Catalog = MyCatalog
Password = "333" # password for FileDaemon
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
#redhat
Client {
Name = redhat-fd
Address = redhat
FDPort = 9102
Catalog = MyCatalog
Password = "333" # password for FileDaemon
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
#sen-lenovo
Client {
Name = sen-lenovo-fd
Address = sen-lenovo
FDPort = 9102
Catalog = MyCatalog
Password = "333" # password for FileDaemon
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
# Definition of file storage device
Storage {
Name = File
# Do not use "localhost" here
Address = ser1 # N.B. Use a fully qualified name here
SDPort = 9103
Password = "222"
Device = FileStorage
Media Type = File
}
# Generic catalog service
Catalog {
Name = MyCatalog
dbname = "bacula"; dbuser = "bacula"; dbpassword = ""
}
# Reasonable message delivery -- send most everything to email address
# and to the console
Messages {
Name = Standard
mailcommand = "/usr/local/bacula/bin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r"
operatorcommand = "/usr/local/bacula/bin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: Intervention needed for %j\" %r"
mail = root@localhost = all, !skipped
operator = root@localhost = mount
console = all, !skipped, !saved
append = "/usr/local/bacula/working/log" = all, !skipped
catalog = all
}
#
# Message delivery for daemon messages (no job).
Messages {
Name = Daemon
mailcommand = "/usr/local/bacula/bin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula daemon message\" %r"
mail = root@localhost = all, !skipped
console = all, !skipped, !saved
append = "/usr/local/bacula/working/log" = all, !skipped
}
# Default pool definition
Pool {
Name = Default
Pool Type = Backup
Recycle = yes # Bacula can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 365 days # one year
}
# File Pool definition
Pool {
Name = File
Pool Type = Backup
Recycle = yes # Bacula can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 365 days # one year
Maximum Volume Bytes = 50G # Limit Volume size to something reasonable
Maximum Volumes = 100 # Limit number of Volumes in Pool
}
# Scratch pool definition
Pool {
Name = Scratch
Pool Type = Backup
}
#client-pool
Pool {
Name = client-pool
Use Volume Once = yes
Pool Type = Backup
Recycle = yes # Bacula can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 365 days # one year
LabelFormat = "${Client}-storage-${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}-id${JobId}"
}
#
# Restricted console used by tray-monitor to get the status of the director
#
Console {
Name = ser1-mon
Password = "444"
CommandACL = status, .status
}
设置连接主控端
Name = name |
指定Director{}名称,设置主控端配置文件中Director{}的Name值,必选。 |
Password = password |
指定主控端配置文件Storage{}的Password值,必选。 |
连接主控端设置范例
Director {
Name = ser1-dir
Password = "222"
}
托盘监控相关设置
Name = name |
指定Director{}名称,设置托盘监控配置文件中Monitor{}的Name值,必选。 |
Password = password |
指定托盘监控配置文件中Storage{}的Password值,必选。 |
Monitor = yesno |
是否开启监控。默认值no |
托盘监控相关设置范例
Director {
Name = ser1-mon
Password = "444"
Monitor = yes
}
Name = name |
指定Storage{}名称,必选。 |
Working Directory = Directory |
指定工作目录,目录必须已经存在,必选。一般在./configure时已经指定。 |
Pid Directory = Directory |
指定进程ID文件存放目录,必选。一般在./configure时已经指定。 |
SDAddresses = IP-address-specification |
指定地址和端口监听主控端连接,详细用法可查看官方文档(Storage Resource)。 |
SDPort = port-number |
指定端口监听主控端连接,默认是9103。不与SDAddresses参数同时使用。 |
SDAddress = IP-Address |
指定地址监听主控端连接,可选。如果它被指定,那么此地址将与存储端绑定;如果未指定将绑定到本机当前使用的地址。只允许指定一个地址。不与SDAddresses参数同时使用。 |
Maximum Concurrent Jobs = number |
设置同时执行的最大任务数量,默认设置为10。 |
Client Connect Wait = time-interval |
客户端连接超时时间。默认为30分钟。 |
Heartbeat Interval = time-interval |
可选。 |
范例
Storage { # definition of myself
Name = ser1-sd
SDPort = 9103 # Director's port
WorkingDirectory = "/usr/local/bacula/working"
Pid Directory = "/usr/local/bacula/bin/working"
Maximum Concurrent Jobs = 20
}
Name = Device-Name |
指定Device{}的名称,必选。 |
Archive Device = name-string |
指定存储设备的路径,可以使磁带驱动器,也可以是一个目录名,必选。 |
Device Type = type-specification |
指定该设备的类型。文件、磁带或DVD。 |
Media Type = name-string |
默认值。 |
Autochanger = yesno |
是否自动更换设备,默认为No。如果是yes,设备必须能自动更换磁带。 |
Maximum Concurent Jobs = number |
设置最大Job连接数 |
Always Open = yesno |
设置设备是否始终保持可用。如果是磁带强烈建议设置为yes;如果是文件存储,设置为no,在需要时自动打开。 |
Removable media = yesno |
可移动媒体支持,默认为no。 |
Random access = yesno |
是否随机存取,默认为yes。如果设备是usb的DVD及所有的文件系统则设置为yes;如果是磁带则为no。 |
范例
Device {
Name = FileStorage
Media Type = File
Archive Device = /opt/backup
LabelMedia = yes; # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
}
此选项不再做介绍,与主控端配置文件的Messages{}的用法一样,可供参考。
贴一下范例
Messages {
Name = Standard
director = ser1-dir = all
}
#
# Default Bacula Storage Daemon Configuration file
#
# For Bacula release 5.0.1 (24 February 2010) -- redhat
#
# You may need to change the name of your tape drive
# on the "Archive Device" directive in the Device
# resource. If you change the Name and/or the
# "Media Type" in the Device resource, please ensure
# that dird.conf has corresponding changes.
#
Storage { # definition of myself
Name = ser1-sd
SDPort = 9103 # Director's port
WorkingDirectory = "/usr/local/bacula/working"
Pid Directory = "/usr/local/bacula/bin/working"
Maximum Concurrent Jobs = 20
}
#
# List Directors who are permitted to contact Storage daemon
#
Director {
Name = ser1-dir
Password = "222"
}
Director {
Name = ser1-mon
Password = "444"
Monitor = yes
}
Device {
Name = FileStorage
Media Type = File
Archive Device = /opt/backup
LabelMedia = yes; # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
}
Messages {
Name = Standard
director = ser1-dir = all
}
设置连接主控端
Name = name |
指定Director{}名称,设置主控端配置文件中Director{}的Name值,必选。 |
Password = password |
指定主控端配置文件Clinet{}的Password值,必选。 |
连接主控端设置范例
Director {
Name = ser1-dir
Password = "333"
}
托盘监控相关设置
Name = name |
指定Director{}名称,设置托盘监控配置文件中Monitor{}的Name值,必选。 |
Password = password |
指定托盘监控配置文件中Client{}的Password值,必选。 |
Monitor = yesno |
是否开启监控。默认值no |
托盘监控相关设置范例
Director {
Name = ser1-mon
Password = "444"
Monitor = yes
}
Name = name |
指定FileDaemon{}名称,必选。 |
Working Directory = Directory |
指定工作目录,目录必须已经存在,必选。一般在./configure时已经指定。 |
Pid Directory = Directory |
指定进程ID文件存放目录,必选。一般在./configure时已经指定。 |
Heartbeat Interval = time-interval |
可选。 |
Maximum Concurrent Jobs = number |
设置同时执行的最大任务数量,默认设置为2。 |
FDAddresses = IP-address-specification |
指定地址和端口监听主控端连接,详细用法可查看官方文档(Client/File daemon Configuration)。 |
FDPort = port-number |
指定端口监听主控端连接,默认是9102。不与FDAddresses参数同时使用。 |
FDAddress = IP-Address |
指定地址监听主控端连接,可选。如果它被指定,那么此地址将与客户端端绑定;如果未指定将绑定到本机当前使用的地址。只允许指定一个地址。不与FDAddresses参数同时使用。 |
FDSourceAddress = IP-Address |
指定地址监听存储端连接,可选。如果它被指定,那么此地址将与客户端端绑定;如果未指定将根据默认路由表。 |
SDConnectTimeout = time-interval |
指定连接到存储端的超时时间,默认为30分钟。 |
范例
FileDaemon { # this is me
Name = ser1-fd
FDport = 9102 # where we listen for the director
WorkingDirectory = /usr/local/bacula/working
Pid Directory = /usr/local/bacula/bin/working
Maximum Concurrent Jobs = 20
}
此选项不再做介绍,与主控端配置文件的Messages{}的用法一样,可供参考。
贴一下范例
Messages {
Name = Standard
director = ser1-dir = all, !skipped, !restored
}
#
# Default Bacula File Daemon Configuration file
#
# For Bacula release 5.0.1 (24 February 2010) -- redhat
#
# There is not much to change here except perhaps the
# File daemon Name to
#
#
# List Directors who are permitted to contact this File daemon
#
Director {
Name = ser1-dir
Password = "333"
}
#
# Restricted Director, used by tray-monitor to get the
# status of the file daemon
#
Director {
Name = ser1-mon
Password = "444"
Monitor = yes
}
#
# "Global" File daemon configuration specifications
#
FileDaemon { # this is me
Name = ser1-fd
FDport = 9102 # where we listen for the director
WorkingDirectory = /usr/local/bacula/working
Pid Directory = /usr/local/bacula/bin/working
Maximum Concurrent Jobs = 20
}
# Send all messages except skipped files back to Director
Messages {
Name = Standard
director = ser1-dir = all, !skipped, !restored
}
有配置文件中控制台的配置文件是最简单的。一般情况下,除了更改密码,其他均不需要更改。它负责连接主控端。
Name = name |
指定主控端名称。设置主控端配置文件中Director{}的Name值,必选。 |
DIRPort = port-number |
指定主控端端口号,默认为9101。 |
Address = address |
指定主控端地址。可以是IP或者计算机名,如果选择计算机名,必须在/etc/hosts文件中加入解析条目,让系统能解析到此计算机名。必选。 |
Password = password |
指定主控端密码。设置主控端配置文件中Director{}的Password值,必选。 |
范例
Director {
Name = ser1-dir
DIRport = 9101
address = ser1
Password = "111"
}
如果你使用GNOME版本的控制台,就可以使用此选项定义窗口的字体。
可选,不必指定。
Name = name |
指定ConsoleFont{}名称。必选 |
Font = Pango Font Name |
指定了Pango格式的字体,默认为 Font = "LucidaTypewriter 9" |
范例
ConsoleFont {
Name = Default
Font = "Monospace 10"
}
可以为控制台设置不同的安全级别。详细可参考官方文档(Console Configuration)。
可选,不必指定。
#
# Bacula User Agent (or Console) Configuration File
#
Director {
Name = ser1-dir
DIRport = 9101
address = ser1
Password = "111"
}
Name = name |
指定Monitor{}名称。用于连接到主控端、存储端及客户端,必选。 |
Password = password |
设置与控制台配置文件Console{}的Password值相同,必选。 |
Refresh Interval = time |
刷新间隔时间默认为5秒,不能超过10分钟,小于1秒。 |
Name = name |
指定Director{}名称,此名称显示在监控进程的列表里,必选。 |
DIRPort = port-number |
指定主控端端口号,默认9101。 |
Address = address |
指定主控端地址。可以是IP或者计算机名,如果选择计算机名,必须在/etc/hosts文件中加入解析条目,让系统能解析到此计算机名。必选。 |
Name = name |
指定Storage{}名称,此名称显示在监控进程的列表里,必选。 |
Address = address |
指定存储端地址。可以是IP或者计算机名,如果选择计算机名,必须在/etc/hosts文件中加入解析条目,让系统能解析到此计算机名。必选。 |
SD Port = port |
指定存储端端口号,默认9103。 |
Password = password |
指定存储端监控端口号,必选。 |
Name = name |
指定Client{}名称,此名称显示在监控进程的列表里,必选。 |
Address = address |
指定客户端地址。可以是IP或者计算机名,如果选择计算机名,必须在/etc/hosts文件中加入解析条目,让系统能解析到此计算机名。必选。 |
FD Port = port-number |
指定存储端端口号,默认9102。 |
Password = password |
指定客户端监控端口号,必选。 |
#
# Bacula Tray Monitor Configuration File
#
Monitor {
Name = ser1-mon
Password = "444" # password for the Directors
RefreshInterval = 5 seconds
}
Client {
Name = ser1-fd
Address = ser1
FDPort = 9102
Password = "444" # password for FileDaemon
}
Storage {
Name = ser1-sd
Address = ser1
SDPort = 9103
Password = "444" # password for StorageDaemon
}
Director {
Name = ser1-dir
DIRport = 9101
address = ser1
}
为了更好理解,下面贴一下主控端、存储端及客户端的配置文件范例
主控端配置文件关于监控相关设置
#
# Restricted console used by tray-monitor to get the status of the director
#
Console {
Name = ser1-mon
Password = "444"
CommandACL = status, .status
}
存储端配置文件关于监控相关设置
Director {
Name = ser1-mon
Password = "444"
Monitor = yes
}
客户端配置文件关于监控相关设置
#
# Restricted Director, used by tray-monitor to get the
# status of the file daemon
#
Director {
Name = ser1-mon
Password = "444"
Monitor = yes
}
6. 启动Bacula
启动Bacula服务之前,可以先测试一下对应的配置文件是否有错误,如下
# cd /usr/local/bacula/bin
# ./bacula-dir -t -c bacula-dir.conf
#./bacula-fd -t -c bacula-fd.conf
#./bacula-sd -t -c bacula-sd.conf
#./bconsole -t -c bconsole.conf
#./bwx-console -t -c bwx-console.conf
#./bat -t -c bat.conf
# su <normal user> -c "./bacula-tray-monitor -t -c tray-monitor.conf"
启动主控端服务
# /etc/init.d/bacula-dir start
启动客户端服务。Windows Bacula客户端服务名称Bacula-fd(Bacula File Service)
# /etc/init.d/bacula-fd start
启动存储端服务
# /etc/init.d/bacula-sd start
一步启动|关闭|重启|状态Bacula三个服务
# /usr/local/bacula/bin/bacula start|stop|restart|status
查看Bacula是否处于监听状态
# netstat –an |grep 910
bacula-dir 9101
bacula-fd 9102
bacula-sd 9103