我搜索了很多,却没有找到一个明确的文档。按照这里提供的说明https://www.bacula.org/9.4.x-manuals/en/main/Migration_Copy.html#SECTION003050000000000000000看来要运行虚拟完整备份,bacula 至少需要 2 个存储守护进程... 我尝试使用相同的存储守护进程设置 2 个池,但作业卡住了,并显示以下消息:storage01-tarquini-sd JobId 127: JobId=127, Job RPROXY.2020-01-05_16.11.39_54 waiting to reserve a device.
我在同一台机器上拥有 bacula dir 和 sd,它们在本地安装的 NFS 上写入。是否可以在同一台机器上运行 2 个 sd?这样做对吗?谢谢!
答案1
在这里找到更多信息:https://www.bacula.org/9.4.x-manuals/en/main/Migration_Copy.html#SECTION003001000000000000000 虚拟完整备份被视为迁移/复制,因此 SD 到 SD 操作也是如此。这些类型的操作需要 2 个存储守护进程。我在 bacula-dir.conf 中设置了一个新的 SD,它指向同一个本地存储守护进程,但名称不同。这样,我可以有 2 个存储设备,一个用于增量池,一个用于虚拟完整备份所需的下一个池。经过测试并正常运行,但欢迎提出任何建议。
答案2
为了帮助未来那些努力进行虚拟完整备份的人,下面概述了我如何在远程存储守护进程上为远程客户端配置虚拟完整备份设置。也就是说,有三个主机(假设可以通过 DNS 或 hosts 文件访问);
bacula.acme.com --> The director
stor02.acme.com --> The storage host
backup.myclient.com --> The computer we want backed up.
总体而言,程序需要 3 个主机之间进行完整的 6 向通信才能正常运行。此处假定所有通信都通过互联网进行,因此数据传输时使用加密。
为了做好这件事,我花了很多时间去摆弄和试验;关于它的文档相当零散:如果你想做一些不同于默认设置的事情,我发现 bacula 会在每一步都与你作对。
这里的目标是在每个工作日后进行增量备份,并利用周末将增量备份整合到虚拟完整备份中。这可最大限度地减少数据传输和存储使用。
请注意,此配置支持同时使用多个客户端,而默认配置每次只执行一个备份。如果 bacula-sd 主机是数据中心等连接良好的区域中的强大服务器,但客户端的连接和磁盘速度要慢得多,则此功能非常有用。
如果需要更长的保留期,请将Backups to keep
指令更改为大于 1 的数字,将其设置为1 + 5 * 'number of weeks to keep'
。同时将用于增量备份的磁带数量从 3 更改为至少 2 +“保留周数”。这可以maximum Volumes
在池配置下找到。我配置了一个额外的磁带,以尽量减少用户进行额外手动备份时磁带用完的可能性。
它主要用于远程备份通过其他软件完成的备份:已经保存了文件的多个版本。
有两个文件夹结构。一个用于导演,一个用于 sd。导演结构如下;
/etc/bacula
/etc/bacula/certs
/etc/bacula/filedefs
/etc/bacula/jobdefs
/etc/bacula/pooldefs
/etc/bacula/storagedefs
/etc/bacula/schedules
sd 目录结构如下:
/etc/bacula
/etc/bacula/devices
每个目录下的每个文件都包含bacula-dir.conf
如下代码:
@|"find /etc/bacula/clientdefs -name '*.conf' -type f -exec echo @{} \;"
@|"find /etc/bacula/jobdefs -name '*.conf' -type f -exec echo @{} \;"
@|"find /etc/bacula/storagedefs -name '*.conf' -type f -exec echo @{} \;"
@|"find /etc/bacula/pooldefs -name '*.conf' -type f -exec echo @{} \;"
@|"find /etc/bacula/filedefs -name '*.conf' -type f -exec echo @{} \;"
@|"find /etc/bacula/schedules -name '*.conf' -type f -exec echo @{} \;"
将配置拆分成多个较小的文件很有用。可以使用模板等快速复制许多客户端的配置更改。配置比单一文件更易读。
然后,对于每台使用 virtualFulls 备份的计算机,在每个目录中创建文件。
在证书,使用openSSL创建公钥和自签名证书。
在客户端定义,创建客户端定义,名为backup.myclient.com-client.conf
。它将看起来像:
Client {
Name = "backup.myclient.com-fd"
Address = backup.myclient.com
FDPort = 9102
Catalog = MyCatalog
Password = "bowoa33bOAIEgklqiowWEEIQmd910GAOIeyglU5N5vr"
File Retention = 30 days
Job Retention = 6 months
AutoPrune = yes
TLS Enable = yes
TLS Require = yes
TLS Certificate = /etc/bacula/certs/backup.myclient.com.crt
TLS Key = /etc/bacula/certs/backup.myclient.com.key
TLS CA Certificate File = /etc/bacula/certs/myca.crt
}
注意:此处的密码必须在导演在文件守护进程中bacula-fd.conf
。同样,密钥和证书也必须复制并设置在那里。稍后同样适用于贮存定义。
在里面工作文件夹中有一个名为 的文件backup.myclient.com-job.conf
。其中包含以下内容:
Job {
Name = "backup.myclient.com-job"
Client = "backup.myclient.com-fd"
FileSet = backup.myclient.com-FileSet
Pool = backup.myclient.com-Inc-Pool-stor02
Priority = 10
# Keeps track of deleted files.
Accurate = yes
Full Backup Pool = backup.myclient.com-Full-Pool-stor02
VirtualFull Backup Pool = backup.myclient.com-Inc-Pool-stor02
Differential Backup Pool = backup.myclient.com-Diff-Pool-stor02
Incremental Backup Pool = backup.myclient.com-Inc-Pool-stor02
# This consolidates backups so you have 1 full and 1-8 incremental at all times.
Backups To Keep = 1
# If the job is blocked (lost connection / not enough volumes?) continue with other jobs.
Max Wait Time = 1h
# Every saturday, the Full backup is copied and the new incremental added.
# This deletes the old copy.
Delete Consolidated Jobs = yes
Enabled = Yes #enable automatic execution
Type = Backup
Schedule = monthly_virtualfull_03
Messages= Standard
Storage = ds_stor02_backup.myclient.com
}
接下来,池定义目录包含每个客户端的存储池配置,因此在示例中,该文件被命名为backup.myclient.com-pool.conf
Pool {
Name = backup.myclient.com-Full-Pool-stor02
Pool Type = Backup
Recycle = yes # automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 31 days
Maximum Volume Jobs = 2
Label Format = backup.myclient.com-Full-
Maximum Volumes = 2
Storage = ds_stor02_vf_backup.myclient.com
}
Pool {
Name = backup.myclient.com-Diff-Pool-stor02
Pool Type = Backup
Recycle = yes
AutoPrune = yes
Volume Retention = 40 days
Maximum Volume Jobs = 1
Label Format = backup.myclient.com-Diff-
Maximum Volumes = 8
Next Pool = backup.myclient.com-Diff-Pool-stor02
Storage = ds_stor02_backup.myclient.com
}
Pool {
Name = backup.myclient.com-Inc-Pool-stor02
Pool Type = Backup
Recycle = yes # automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
# One day more than the longest month.
Volume Retention = 10 days
Maximum Volume Jobs = 5
Label Format = backup.myclient.com-Inc-
Maximum Volumes = 3
Storage = ds_stor02_backup.myclient.com
}
为了时间表,需要一个文件,virtualfull_03.conf
;
Schedule {
Name = "monthly_virtualfull_03"
Run = VirtualFull sat at 10:00
Run = Incremental mon-sat at 00:30
}
在选择夜间时间时:如果您所在的世界任何地方仍遵守 DST(大部分地区),请注意不要选择01:00
和03:00
之间的任何时间,否则 DST 转换可能会导致您的备份无法运行(或尝试运行两次)。或者:将您的导演配置为使用 UTC(并且不关心备份是否会在一年中的某些时间提前一小时运行)。
当然,如果客户端需要在不同的日期和时间运行,可以添加更多的计划来实现这一点。
接下来,存储定义通过创建单独的存储,我们可以拥有我们想要的单独行为;对于 virtualFull,您需要创建二storagedefs,都指向同一个存储守护进程。
Storage {
Name = ds_stor02_backup.myclient.com
Address = stor02.acme.com # N.B. Use a fully qualified name here
SDPort = 9103
Password = 98C_DcJmmAjWqjqleIIo19xIiGHGHqzi
Device = stor02_backup.myclient.com
Media Type = mt_stor02_backup.myclient.com
Maximum Concurrent Jobs = 50
TLS Enable = yes
TLS Require = yes
TLS Certificate = /etc/bacula/certs/stor02.acme.com.crt
TLS Key = /etc/bacula/certs/stor02.acme.com.key
TLS CA Certificate File = /etc/bacula/certs/myca.crt
}
Storage {
Name = ds_stor02_vf_backup.myclient.com
Address = stor02.acme.com # N.B. Use a fully qualified name here
SDPort = 9103
Password = 98C_DcJmmAjWqjqleIIo19xIiGHGHqzi
Device = stor02_vf_backup.myclient.com
Media Type = mt_stor02_vf_backup.myclient.com
Maximum Concurrent Jobs = 50
Autochanger = yes
TLS Enable = yes
TLS Require = yes
TLS Certificate = /etc/bacula/certs/stor02.acme.com.crt
TLS Key = /etc/bacula/certs/stor02.acme.com.key
TLS CA Certificate File = /etc/bacula/certs/myca.crt
}
最后,你至少需要三虚拟完整设备。一个磁带驱动器用于读取完整备份磁带的当前完整备份。一个磁带驱动器用于将合并结果写入另一个完整备份磁带,第三个磁带驱动器用于读取增量备份。(注意:如果您使用的是实际磁带驱动器,而不是示例中的文件,则为增量读取添加第二个自动转换器,并且每个磁带都有一个驱动器,这对于全自动备份来说是最佳选择。)
这些设备配置在存储守护进程,不在导演上,在devices
包含的文件夹里面bacula-sd.conf
(通过与上面相同的方法)。
在这里,我们还在引号之间定义了一个“自动转换器”。使用随机访问介质从同一驱动器读取/写入多个作业的 bacula 代码存在错误。它不会这样做,并且会无休止地停滞,抱怨介质类型,或者出现许多其他问题之一。制作一个假的磁带驱动器设置将起作用,而且完美无缺。这看起来像这样(backup.myclient.com-device.conf
):
Device {
Name = stor02_backup.myclient.com
Media Type = mt_stor02_backup.myclient.com
Archive Device = /zfs1/myclient/backups/backup.myclient.com/
LabelMedia = yes;
Random Access = yes;
AutomaticMount = yes;
RemovableMedia = no;
AlwaysOpen = no;
Maximum Concurrent Jobs = 2
}
Autochanger {
Name = stor02_vf_backup.myclient.com
Device = stor02_vf_backup.myclient.com_1, stor02_vf2_backup.myclient.com_2
Changer Device = /dev/null
Changer Command = ""
}
Device {
Name = stor02_vf_backup.myclient.com_1
Media Type = mt_stor02_vf_backup.myclient.com
Archive Device = /zfs1/myclient/backups/backup.myclient.com_vf/
LabelMedia = yes;
Random Access = yes;
AutomaticMount = yes;
RemovableMedia = no;
AlwaysOpen = no;
Maximum Concurrent Jobs = 2
}
Device {
Name = stor02_vf2_backup.myclient.com_2
Media Type = mt_stor02_vf_backup.myclient.com
Archive Device = /zfs1/myclient/backups/backup.myclient.com_vf/
LabelMedia = yes;
Random Access = yes;
AutomaticMount = yes;
RemovableMedia = no;
AlwaysOpen = no;
Maximum Concurrent Jobs = 2
}