如何部署Bareos备份6-备份GlusterFS

Bareos

6 备份GlusterFS的数据

6.1 基本配置

6.1.1 配置存储客户端名称

In GlusterFS-Clients

hostnamectl set-hostname gfs-client.cmdschool.org

6.1.2 配置时区和NTP服务

In GlusterFS-Clients
时区配置

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

安装ntp同步服务

yum install -y chrony

启动ntp服务

systemctl start chronyd
systemctl enable chronyd

同步时间

chronyc sources

6.1.3 防火墙配置

In GlusterFS-Clients

firewall-cmd --permanent --add-port 9102/tcp
firewall-cmd --reload
firewall-cmd --list-all

6.2 安装存储客户端软件包

6.2.1 配置yum源

In GlusterFS-Clients

curl http://download.bareos.org/bareos/release/latest/CentOS_7/bareos.repo > /etc/yum.repos.d/bareos.repo

6.2.2 安装相关包

In GlusterFS-Clients

yum install -y bareos-filedaemon

6.2.3 启动并配置自启服务

In GlusterFS-Clients

systemctl start bareos-fd
systemctl enable bareos-fd

6.3 添加客户端

6.3.1 服务端添加客户端

In Server

bconsole
Connecting to Director localhost:9101
1000 OK: bareos-dir Version: 16.2.4 (01 July 2016)
Enter a period to cancel a command.
*configure add client name= gfs-client-fd address=10.168.0.23 password=abc123
*reload
reloaded
*

注:手动配置请使用以下方法

vim /etc/bareos/bareos-dir.d/client/bareos-client.conf

输入如下配置:

Client {
  Name = gfs-client-fd
  Address = 10.168.0.21
  Password = abc123
}

重启服务使配置生效

bconsole
Connecting to Director localhost:9101
1000 OK: bareos-dir Version: 16.2.4 (01 July 2016)
Enter a period to cancel a command.
*reload
reloaded
*

6.3.2 复制导出目录配置到客户端

In Server

scp /etc/bareos/bareos-dir-export/client/bareos-client/bareos-fd.d/director/bareos-dir.conf root@10.168.0.23:/etc/bareos/bareos-fd.d/director/

6.3.3 修改客户端名字声明

In GlusterFS-Clients

vim /etc/bareos/bareos-fd.d/client/myself.conf

修改如下名字与添加客户端名字一致

Name = gfs-client-fd

6.3.4 修改客户端如何发消息

In GlusterFS-Clients

cat /etc/bareos/bareos-fd.d/messages/Standard.conf

参数如下:

Messages {
  Name = Standard
  Director = bareos-dir = all, !skipped, !restored
  Description = "Send relevant messages to the Director."
}

注:以上将消息发给Direcotr

6.3.6 重启客户端服务

In GlusterFS-Clients

systemctl restart bareos-fd

6.3.7 测试客户端连接

*show clients
*status client=gfs-client-fd

6.4 安装配置存储插件

6.4.1 安装客户端插件

In GlusterFS-Clients

yum install -y bareos-filedaemon-glusterfs-plugin

6.4.2 定义要备份的数据

In Server

cp /etc/bareos/bareos-dir.d/fileset/plugin-gfapi.conf.example /etc/bareos/bareos-dir.d/fileset/plugin-gfapi.conf
chown bareos:bareos /etc/bareos/bareos-dir.d/fileset/plugin-gfapi.conf
vim /etc/bareos/bareos-dir.d/fileset/plugin-gfapi.conf

定义如下配置:

FileSet {
  Name = "plugin-gfapi"
  Include {
    Options {
      aclsupport = yes
      signature = MD5
      xattrsupport = yes
    }
    # adapt this to your environment
    Plugin = "gfapi:volume=gluster\\://GFS02/gv_bareos_2/files:"
  }
}

6.4.3 定义作业文件

In Server

cp /etc/bareos/bareos-dir.d/job/BackupGFAPI.conf.example /etc/bareos/bareos-dir.d/job/BackupGFAPI.conf
chown bareos:bareos /etc/bareos/bareos-dir.d/job/BackupGFAPI.conf
vim /etc/bareos/bareos-dir.d/job/BackupGFAPI.conf

定义如下配置:

Job {
  Name = "BackupGFAPI"
  JobDefs = "DefaultJob"
  FileSet = "plugin-gfapi"
  # Client = "gfapihost-fd"
}

6.4.4 备份客户端启用插件

In GlusterFS-Clients

vim /etc/bareos/bareos-fd.d/client/myself.conf

增加如下配置:

  Plugin Directory = /usr/lib64/bareos/plugins
  Plugin Names = "gfapi"

6.4.5 预演备份作业

In Server

*estimate listing job=BackupGFAPI
Using Catalog "MyCatalog"
Connecting to Client bareos-fd at localhost:9102
fd_plugins.c:1011 Command plugin "gfapi:volume=gluster\://GFS02/gv_bareos_2/files:" not found.
2000 OK estimate files=0 bytes=0

注:没有正确的提示信息,我们忽略此信息

6.4.6 运行作业

In Server

*run job=BackupGFAPI
Run Backup job
JobName:  BackupGFAPI
Level:    Incremental
Client:   bareos-fd
Format:   Native
FileSet:  plugin-gfapi
Pool:     Incremental (From Job IncPool override)
Storage:  Gluster (From Job resource)
When:     2017-09-06 15:57:19
Priority: 10
OK to run? (yes/mod/no): yes
Job queued. JobId=64
You have messages.

查看消息确认备份:

*messages
06-Sep 15:57 bareos-dir JobId 64: No prior Full backup Job record found.
06-Sep 15:57 bareos-dir JobId 64: No prior or suitable Full backup found in catalog. Doing FULL backup.
06-Sep 15:57 bareos-dir JobId 64: Start Backup JobId 64, Job=BackupGFAPI.2017-09-06_15.57.21_07
06-Sep 15:57 bareos-dir JobId 64: Using Device "GlusterStorage" to write.
06-Sep 15:57 bareos-sd JobId 64: Volume "Full-0001" previously written, moving to end of data.
06-Sep 15:57 bareos-sd JobId 64: Ready to append to end of Volume "Full-0001" size=253449423
06-Sep 15:57 bareos-sd JobId 64: Elapsed time=00:00:01, Transfer rate=757.0 K Bytes/second
06-Sep 15:57 bareos-dir JobId 64: Bareos bareos-dir 16.2.4 (01Jul16):
  Build OS:               x86_64-redhat-linux-gnu redhat CentOS Linux release 7.0.1406 (Core)
  JobId:                  64
  Job:                    BackupGFAPI.2017-09-06_15.57.21_07
  Backup Level:           Full (upgraded from Incremental)
  Client:                 "bareos-fd" 16.2.4 (01Jul16) x86_64-redhat-linux-gnu,redhat,CentOS Linux release 7.0.1406 (Core) ,CentOS_7,x86_64
  FileSet:                "plugin-gfapi" 2017-09-06 13:24:18
  Pool:                   "Full" (From Job FullPool override)
  Catalog:                "MyCatalog" (From Client resource)
  Storage:                "Gluster" (From Job resource)
  Scheduled time:         06-Sep-2017 15:57:19
  Start time:             06-Sep-2017 15:57:23
  End time:               06-Sep-2017 15:57:23
  Elapsed time:           0 secs
  Priority:               10
  FD Files Written:       5
  SD Files Written:       5
  FD Bytes Written:       756,220 (756.2 KB)
  SD Bytes Written:       757,019 (757.0 KB)
  Rate:                   0.0 KB/s
  Software Compression:   None
  VSS:                    no
  Encryption:             no
  Accurate:               no
  Volume name(s):         Full-0001
  Volume Session Id:      3
  Volume Session Time:    1504682902
  Last Volume Bytes:      254,207,646 (254.2 MB)
  Non-fatal FD errors:    0
  SD Errors:              0
  FD termination status:  OK
  SD termination status:  OK
  Termination:            Backup OK

===========================================================
官方文档
————-
https://github.com/bareos/bareos-docs
http://doc.bareos.org/master/html/bareos-manual-main-reference.html

官方源
————-
http://download.bareos.org/bareos/release/

没有评论

发表回复

Bareos
如何部署Bareos备份5-备到GlusterFS

5 备份保存到GlusterFS 5.1 基本配置 5.1.1 配置名称解析 vim /etc/ho …

Bareos
如何部署Bareos备份4-添加客户端

4 添加备份客户端 4.1 基本配置 4.1.1 配置主机名称 In Clients hostnam …

Bareos
如何部署Bareos备份3-使用控制台

3 使用备份控制台 In Server 3.1 bconsole的基本指令 3.1.1 启动bcon …