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

Bareos

4 添加备份客户端

4.1 基本配置

4.1.1 配置主机名称

In Clients

hostnamectl set-hostname bareos-client.cmdschool.org

4.1.2 配置时区和NTP服务

In Clients
时区配置

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

安装ntp同步服务

yum install -y chrony

启动ntp服务

systemctl start chronyd
systemctl enable chronyd

同步时间

chronyc sources

4.1.3 防火墙配置

In Clients

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

4.2 安装客户端软件包

4.2.1 配置yum源

In Clients

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

4.2.2 安装相关包

In Clients

yum install -y bareos-filedaemon

4.2.3 启动并配置自启服务

In Clients

systemctl start bareos-fd
systemctl enable bareos-fd

4.3 添加客户端

4.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=bareos-client-fd address=10.168.0.21 password=abc123
*reload
reloaded
*

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

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

输入如下配置:

Client {
  Name = bareos-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
*

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

In Server

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

4.3.3 修改客户端名字声明

In Clients

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

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

Name = bareos-client-fd

4.3.4 修改客户端如何发消息

In 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

4.3.5 重启客户端服务

In Clients

 
systemctl restart bareos-fd

4.3.6 测试客户端连接

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

4.4 添加客户端作业

4.4.1 添加作业资源

In Server

*configure add job name=bareos-client-job-fd  client=bareos-client-fd jobdefs=DefaultJob

信息显示如下:

Created resource config file "/etc/bareos/bareos-dir.d/job/bareos-client-job.conf":
Job {
  Name = bareos-client-job-fd
  Client = bareos-client-fd
  JobDefs = DefaultJob
}

4.4.2 预演作业

In Server

*estimate listing job=bareos-client-job-fd

注:以上只是预估备份的文件列表

4.4.3 运行作业

In Server

*run job=bareos-client-job-fd

4.4.4 等待作业完成

In Server

*wait jobid=…

4.4.5 验证作业

In Server

*list joblog jobid=…
*list files jobid=…
*list volumes

4.5 排除故障

4.5.1 查阅故障

In Server

 
*list joblog jobid=…

发现如下错误:

 2017-08-31 14:40:46 bareos-dir JobId 15: Start Backup JobId 15, Job=bareos-client-job-fd.2017-08-31_14.40.44_00
 2017-08-31 14:40:46 bareos-dir JobId 15: Using Device "FileStorage" to write.
 2017-08-31 14:40:56 bareos-client JobId 15: Warning: bsock_tcp.c:128 Could not connect to Storage daemon on localhost:9103. ERR=Connection refused
Retrying ...
 2017-08-31 14:46:06 bareos-client JobId 15: Warning: bsock_tcp.c:128 Could not connect to Storage daemon on localhost:9103. ERR=Connection refused
Retrying ...
 2017-08-31 14:51:16 bareos-client JobId 15: Warning: bsock_tcp.c:128 Could not connect to Storage daemon on localhost:9103. ERR=Connection refused
Retrying ...
 2017-08-31 14:56:26 bareos-client JobId 15: Warning: bsock_tcp.c:128 Could not connect to Storage daemon on localhost:9103. ERR=Connection refused
Retrying ...
 2017-08-31 15:01:36 bareos-client JobId 15: Warning: bsock_tcp.c:128 Could not connect to Storage daemon on localhost:9103. ERR=Connection refused
Retrying ...
 2017-08-31 15:06:46 bareos-client JobId 15: Warning: bsock_tcp.c:128 Could not connect to Storage daemon on localhost:9103. ERR=Connection refused
Retrying ...
 2017-08-31 15:10:46 bareos-client JobId 15: Fatal error: bsock_tcp.c:134 Unable to connect to Storage daemon on localhost:9103. ERR=Connection refused
 2017-08-31 15:10:46 bareos-client JobId 15: Fatal error: Failed to connect to Storage daemon: localhost:9103
 2017-08-31 15:10:46 bareos-dir JobId 15: Fatal error: Bad response to Storage command: wanted 2000 OK storage
, got 2902 Bad storage

 2017-08-31 15:10:46 bareos-dir JobId 15: Error: Bareos bareos-dir 16.2.4 (01Jul16):
  Build OS:               x86_64-redhat-linux-gnu redhat CentOS Linux release 7.0.1406 (Core)
  JobId:                  15
  Job:                    bareos-client-job-fd.2017-08-31_14.40.44_00
  Backup Level:           Full
  Client:                 "bareos-client" 16.2.4 (01Jul16) x86_64-redhat-linux-gnu,redhat,CentOS Linux release 7.0.1406 (Core) ,CentOS_7,x86_64
  FileSet:                "SelfTest" 2017-08-29 05:01:45
  Pool:                   "Full" (From command line)
  Catalog:                "MyCatalog" (From Client resource)
  Storage:                "File" (From Job resource)
  Scheduled time:         31-Aug-2017 14:40:43
  Start time:             31-Aug-2017 14:40:46
  End time:               31-Aug-2017 15:10:46
  Elapsed time:           30 mins
  Priority:               10
  FD Files Written:       0
  SD Files Written:       0
  FD Bytes Written:       0 (0 B)
  SD Bytes Written:       0 (0 B)
  Rate:                   0.0 KB/s
  Software Compression:   None
  VSS:                    no
  Encryption:             no
  Accurate:               no
  Volume name(s):
  Volume Session Id:      3
  Volume Session Time:    1504157857
  Last Volume Bytes:      0 (0 B)
  Non-fatal FD errors:    2
  SD Errors:              0
  FD termination status:  Fatal Error
  SD termination status:  Waiting on FD
  Termination:            *** Backup Error ***

4.5.2 更正存储配置文件

In Server
修改以下配置文件:

vim /etc/bareos/bareos-dir.d/storage/File.conf

修改如下参数:

Address = 10.168.0.22

4.5.3 重启服务使配置生效

In Server

systemctl restart bareos-dir bareos-fd bareos-sd

===========================================================
官方文档
————-
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备份6-备份GlusterFS

6 备份GlusterFS的数据 6.1 基本配置 6.1.1 配置存储客户端名称 In Glust …

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

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

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

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