备份/恢复系统BAREOS的安装、设置和使用(二)

备份/恢复系统BAREOS的设置

本文将介绍如何设置bareos系统,将分别介绍Bareos系统主机设置(含Director Daemon、Storage Daemon和Storage Daemon)、客户机安装/设置和系统集成测试。

在介绍设置前,我们先简单介绍一下bareos系统架构,方便大家理解。

管理终端:
bconsole:全功能CLI管理终端。
WebUI:只能用于备份和恢复,同时包含基于Web的CLI界面。

管理服务(Director Daemon):
运行在bareos管理机上,包含全部管理功能、CLI管理服务、WebUI后台支持、目录(catalog)数据库支持等。

存储服务(Storage Daemon):
运行在bareos管理机上,支持不同的物理存储媒体(如硬盘存储系统、磁带存储系统等),管理数据的读取和存储。

文件服务(File Daemon):
运行在客户机上,管理本地文件的备份和恢复。

储存媒体:
物理存储媒体(如硬盘存储系统、磁带存储系统等)。


Bareos系统设置

配置Bareos存储服务(Storage Daemon)模块

Bareos存储服务(Storage)模块为bareos系统提供数据存储服务模块。它的配置文件位于/etc/bareos/bareos-sd.d目录下。

root@bareos:/etc/bareos/bareos-sd.d# ls -l
total 16
drwxr-x--- 2 bareos bareos 4096 Sep 16 11:37 device
drwxr-x--- 2 bareos bareos 4096 Sep 16 11:37 director
drwxr-x--- 2 bareos bareos 4096 Sep 16 11:44 messages
drwxr-x--- 2 bareos bareos 4096 Sep 16 11:43 storage
root@bareos:/etc/bareos/bareos-sd.d#

配置Storage的存储设备

device下放的是存储媒体配置文件,bareos系统是基于文件的备份/恢复系统,device下只有一个配置文件FileStorage.conf。

可能的FileStorage.conf如下:

# HDD 存储设备
Device {
  Name = FileStorage                  # 设备名称
  Media Type = File                   # 类型,bareos是基于文件的备份/恢复系统,类型永远是文件
  Archive Device = /bareos/hdd        # Ubuntu下的备份文件目录(或mount point)
  LabelMedia = yes;                   # lets Bareos label unlabeled media
  Random Access = yes;                # 可随机读写
  AutomaticMount = yes;               # 自动加载
  RemovableMedia = no;                # 媒体介质不可移除
  AlwaysOpen = yes;                   # 总是打开
}

# 磁带存储设备
Device {
  Name = TapeStorage                  # 设备名称
  Media Type = File                   # 类型,bareos是基于文件的备份/恢复系统,类型永远是文件
  Archive Device = /bareos/tape       # Ubuntu下的mount point
  LabelMedia = yes;                   # lets Bareos label unlabeled media
  Random Access = no;                 # 不能随机读写
  AutomaticMount = no;                # 不自动加载
  RemovableMedia = yes;               # 媒体介质可移除
  AlwaysOpen = no;                    # 按需打开
}

在上述配置文件中,我们配置了二种存储设备,分别是硬盘和磁带。在配置时,请注意被配置存储设备的物理属性。硬盘类的存储设备是可随机读写,磁带类的是不可随机读写。
现在公司一般很少配磁带备份,我们的备份方案是:在/bareos/hdd下挂载SAN设备,然后通过rsync将/bareos/hdd目录下的内容同步到远程SAN上,从而保证数据的安全。

实例中的FileStorage.conf文件:

/etc/bareos/bareos-sd.d/device/FileStorage.conf

# HDD 存储设备
Device {
  Name = FileStorage                  # 设备名称
  Media Type = File                   # 类型,bareos是基于文件的备份/恢复系统,类型永远是文件
  Archive Device = /bareos/hdd        # Ubuntu下的mount point
  LabelMedia = yes;                   # lets Bareos label unlabeled media
  Random Access = yes;                # 可随机读写
  AutomaticMount = yes;               # 自动加载
  RemovableMedia = no;                # 媒体介质不可移除
  AlwaysOpen = yes;                   # 总是打开
}

配置Storage的ACL
director下有二个配置文件bareos-dir.confbareos-mon.conf,分别用于管理director和monitor对storage模块的授权。

/etc/bareos/bareos-sd.d/director/bareos-dir.conf

Director {
  Name = bareos-dir                                             # 名字
  Password = "JgwtSYloo93DlXnt/cjUfPJIAD9zocr920FEXEV0Pn+S"     # 密码
  Description = "允许操作此storage的Director设置"
}

/etc/bareos/bareos-sd.d/director/bareos-mon.conf

Director {
  Name = bareos-mon
  Password = "4wdzVcvZAFgTz+IWlB4C5hd09czTXhsAd8SnZQ1VZn4X"
  Monitor = yes 
  Description = "允许读取此storage状态的Monitor设置"
}

monitor是bareos的GUI监视程序。

配置 storage 相关信息服务

/etc/bareos/bareos-sd.d/messages/Standard.conf

Messages {
  Name = Standard
  Director = bareos-dir = all # bareos-dir:发送信息到bareis-dir,all:所有信息
  # mailcommand =  # 可执行命令或脚本
  # operatorcommand = # 可执行命令或脚本
  Description = "Send all messages to the Director."
  # 可用参数
  # %% = %
  # %c = Client’s name
  # %d = Director’s name
  # %e = Job Exit code (OK, Error, ...)
  # %h = Client address
  # %i = Job Id
  # %j = Unique Job name
  # %l = Job level
  # %n = Job name
  # %r = Recipients
  # %s = Since time
  # %t = Job type (e.g. Backup, ...)
  # %v = Read Volume name (Only on director side)
  # %V = Write Volume name (Only on director side)
}

配置 storage 相关特性或功能

Storage {
  Name = bareos-sd
  Maximum Concurrent Jobs = 20

  # remove comment from "Plugin Directory" to load plugins from specified directory.
  # if "Plugin Names" is defined, only the specified plugins will be loaded,
  # otherwise all storage plugins (*-sd.so) from the "Plugin Directory".
  #
  # Plugin Directory = /usr/lib/bareos/plugins
  # Plugin Names = ""
}

一般情况下,我们只需要修改FileStorage.conf配置文件中的Archive Device,默认的Archive Device/var/lib/bareos/storage,默认的bareos-sd配置能满足一般需求。

修改bareos-sd的配置后,必须重启bareos-sd。在重启bareos-sd前,请首先使用bareos-sd -t -v检查bareos-sd配置文件。如bareos-sd -t -v没有任何输出,说明配置文件没有任何语法问题,可以重启bareos-sd


配置Bareos管理(Director)模块

Bareos管理(Director)模块为bareos系统管理模块。它的配置文件位于/etc/bareos/bareos-dir.d目录下。

root@bareos:/etc/bareos/bareos-dir.d# ls -l
total 48
drwxr-x--- 2 bareos bareos 4096 Sep 11 09:13 catalog 
drwxr-x--- 2 bareos bareos 4096 Sep 11 09:13 client
drwxr-x--- 2 bareos bareos 4096 Sep 11 11:08 console
drwxr-x--- 2 bareos bareos 4096 Sep 15 20:42 director
drwxr-x--- 2 bareos bareos 4096 Sep 11 09:13 fileset
drwxr-x--- 2 bareos bareos 4096 Sep 11 09:13 job
drwxr-x--- 2 bareos bareos 4096 Sep 11 09:13 jobdefs
drwxr-x--- 2 bareos bareos 4096 Sep 18 17:18 messages
drwxr-x--- 2 bareos bareos 4096 Sep 11 09:13 pool
drwxr-x--- 2 bareos bareos 4096 Sep 15 20:45 profile
drwxr-x--- 2 bareos bareos 4096 Sep 11 09:13 schedule
drwxr-x--- 2 bareos bareos 4096 Sep 11 09:13 storage
root@bareos:/etc/bareos/bareos-dir.d# 

配置文件的文件名可任意,但必须以.conf结尾。

目录(catalog)数据库链接方式配置文件
/etc/bareos/bareos-dir.d/MyCatalog.conf

Catalog {
  Name = MyCatalog          # catalog名字
  dbdriver = mysql          # 使用MySQL驱动(兼容MariaDB)
  dbname = bareos           # 数据库名
  dbuser = bareos           # 该数据库之用户名
  dbpassword = bareos       # 该用户之密码
}

该文件在安装bareos-mysql时已被初始化,一般情况下无需修改。

客户端(File Daemon)配置文件
/etc/bareos/bareos-dir.d/client/clientname-fd.conf

下面是bareos服务器的默认File Daemon配置文件:

Client {
  Name = bareos-fd                                                   # Director中使用的客户端名字
  Description = "Client resource of the Director itself."            # 解释
  Address = localhost                                                # 客户端FQDN或IP地址
  Password = "QGSqraVyf7kQfpdTxv+j/h27nesW7ypmGP5wLPLXltE9"          # 密码
}

配置客户端可以直接建立/修改配置文件,也可以通过bconsole来完成。

下面是使用bconsole建立客户端示例:
root@bareos:~# bconsole
Connecting to Director localhost:9101
1000 OK: bareos-dir Version: 17.2.4 (21 Sep 2017)
Enter a period to cancel a command.
*configure add client name=lscms-fd address=lscms.lswin.cn password=lscmsFdPasswd

我们可以在/etc/bareos/bareos-dir.d/client下见到新的客户端配置文件lscms-fd.conf。内容为:

Client {
  Name = lscms-fd
  Address = lscms.lswin.cn
  Password = lscmsFdPasswd
}

终端(console)配置文件
在该目录(/etc/bareos/bareos-dir.d/console)下有二个配置文件:admin.conf 和 bareos-mon.conf
/etc/bareos/bareos-dir.d/console/admin.conf:Web GUI 配置文件
/etc/bareos/bareos-dir.d/console/bareos-mon.conf:Bareos 托盘监测配置文件

Web GUI 配置文件 /etc/bareos/bareos-dir.d/console/admin.conf

Console {
  Name = admin
  Password = pwd111111
  Profile = webui-admin             # 指明是为WebGUI,该名字必须是webui-admin
}

托盘监测配置文件/etc/bareos/bareos-dir.d/console/bareos-mon.conf

Console {
  Name = bareos-mon
  Description = "Restricted console used by tray-monitor to get the status of the director."
  Password = "8ipdQxiufhgskdNWk4ydvVWZfXGa9SmVBG690X+Mh9Ph"
  CommandACL = status, .status             # 只有 status 命令或 .status命令被授权
  JobACL = *all*                           # 所有任务都被授权
}

一般情况下,这些文件无需修改。

控制端(Director)配置文件
/etc/bareos/bareos-dir.d/director/bareos-dir.conf

Director {                                                          # 配置控制端
  Name = bareos-dir
  QueryFile = "/usr/lib/bareos/scripts/query.sql"
  Maximum Concurrent Jobs = 10    
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
备份恢复系统是一种用于保护和恢复计算机系统数据和设置的重要工具。设计备份恢复系统需要考虑以下几个关键方面。 首先,备份策略是设计备份系统的核心。备份策略应该涵盖备份的频率、目标、存储位置以及备份类型等。备份频率可以根据业务需求来确定,可以选择每日、每周或每月备份备份目标可以是本地设备或者远程服务器,以确保数据安全。存储位置可以是硬盘、网络存储设备或者云存储等。备份类型可以选择全量备份或增量备份,全量备份可以备份整个系统,而增量备份备份变动的数据,可以减少备份时间和存储空间。 其次,备份恢复过程的可靠性是设计备份系统的重要考虑因素。备份系统应该具备自动化和可靠的备份恢复机制。备份过程应该能够自动运行,无需人工干预,以避免人为错误。同时,备份过程应该有错误检测和纠正机制,以确保备份数据的完整性和一致性。在恢复过程中,系统应该能够快速、准确地还原数据和设置,以尽量减少系统中断时间。 另外,数据安全性也是备份恢复系统设计中的重要考虑因素。备份数据应该进行加密和压缩,以确保数据隐私和存储效率。存储位置应具备防火墙、访问控制和监控机制,以保护备份数据免受未经授权的访问和攻击。 最后,备份恢复系统设计也应考虑可扩展性和灵活性。系统应具备可扩展的存储容量和性能,以应对数据量的增长。同时,备份系统应支持不同的操作系统和应用程序,以满足不同的业务需求。 总之,备份恢复系统设计是确保计算机系统数据安全和可恢复性的重要保障。通过合理的备份策略、可靠的备份恢复机制、高度的数据安全性和灵活的设计,可以保护和恢复计算机系统的数据和设置,提高系统的可靠性和稳定性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值