分享

企业级的开源备份工具之磁盘柜存储配置

 德威雅 2019-06-30

一、iscsi网络存储

1.1 配置FreeNAS

    考虑专业的磁盘柜价格不菲,而使用服务器的方式一方面磁盘容量有限,另一方面IO的性能也很难保障。FreeNAS是一套免费的NAS服务器,它能将一部普通PC变成网络存储服务器。用户可通过Windows、Macs、FTP、SSH 及网络文件系统 (NFS) 来访问存储服务器。

    我们通过它来组建符合企业使用的备份存储设备,该系统具体的安装步骤可参考相关资源。这里通过启用iscsi功能实现网络备份存储,相关设置如下图。

wKiom1eER2_RUhhNAABZsdLq3WY635.png-wh_50

wKioL1eER3CTdT2XAABgVhWh2zE608.png-wh_50

wKiom1eER3CAyiRkAABxGrhJMJo525.png-wh_50

1.2 配置iscsi客户端

    iSCSI的服务器端已经在FreeNAS上完成配置,接下来需要在linux系统上完成客户端的配置,实现在客户端对网络存储的挂载。

    首先安装相关的系统组件并完成配置文件的修改。

yum -y install iscsi-initiator-utils vi /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.2016-06.com.redhat:82367514497d#客户端的标记

    接下来修改主要的配置文件。

vi /etc/iscsi/iscsid.conf
node.session.auth.authmethod = CHAP#根据freenas的设置修改node.session.auth.username = myj.5.199node.session.auth.password = testtesttestdiscovery.sendtargets.auth.authmethod = CHAP#根据freenas的设置修改discovery.sendtargets.auth.username = backup.myjdiscovery.sendtargets.auth.password = testtesttest

  完成设置后通过以下指令查看配置和连接情况。

iscsiadm -m discovery -t sendtargets -p 192.168.5.199iscsiadm -m node -o show

wKioL1eER9yzNBLDAAD8B7SlqnY511.png-wh_50

wKiom1eER93CPeuDAAAzwCWmfkw827.png-wh_50

1.3 配置开机自动挂载

    完成iSCSI的配置后,接下来配置开机自动挂载及相应的服务自动启动设定,具体系统分区操作略。

systemctl enable iscsid.serviceiscsiadm -m node -T iqn.2005-10.org.freenas.ctl:backu-10ttarget -p 192.168.5.199 --op update -n node.startup -v automaticLs -l /dev/disk/by-uuidBlkid /dev/sdc1

wKioL1eESBXhGHzMAABlgJbPOLg238.png-wh_50

二、备份存储设置

2.1 配置bacula-dir.conf

JobDefs {  Name = 'DefaultJob'  Type = Backup  Level = Incremental  Client = bak-192.168.0.97  FileSet = 'Windows'  Schedule = 'WeeklyCycle'  Storage = windows-file  Messages = Standard  Pool = Default  Full Backup Pool = full-pool  Incremental Backup Pool = inc-pool  Differential Backup Pool = diff-pool  SpoolAttributes = yes  Priority = 10  Write Bootstrap = '/var/spool/bacula/%h.bsr'}Job {  Name = 'bak-192.168.0.97'  JobDefs = 'DefaultJob'}Job{  Name = 'bak-192.168.5.86'  Type = Backup  Level = Incremental  Client = bacula-fd  FileSet = 'Bacula Set'  Schedule = 'WeeklyCycle'  Storage = linux-file  Messages = Standard  Pool = Default  Full Backup Pool = full-pool  Incremental Backup Pool = inc-pool  Differential Backup Pool = diff-pool  SpoolAttributes = yes  Priority = 10  Write Bootstrap = '/var/spool/bacula/%h.bsr'}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/libexec/bacula/make_catalog_backup.pl MyCatalog'  # This deletes the copy of the catalog  RunAfterJob  = '/usr/libexec/bacula/delete_catalog_backup'  Write Bootstrap = '/var/spool/bacula/%n.bsr'  Priority = 11                   # run after main backup}Job {  Name = 'RestoreFiles'  Type = Restore  Client=bacula-fd  FileSet='Bacula Set'  Storage = linux-file  Pool = Default  Full Backup Pool = full-pool  Incremental Backup Pool = inc-pool  Differential Backup Pool = diff-pool  Messages = Standard  Where = /tmp/bacula-restores}FileSet {  Name = 'Windows'  Include {    Options {      signature = MD5      compression = GZIP      IgnoreCase = yes    }    File = 'e:/datatbak'  }}FileSet {  Name = 'Bacula Set'  Include {    Options {      signature = MD5      Compression = GZIP    }    File = /var/lib/mysql  }  Exclude {    File = /var/spool/bacula    File = /tmp    File = /proc    File = /tmp    File = /sys    File = /.journal    File = /.fsck  }}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}Schedule {  Name = 'WeeklyCycleAfterBackup'  Run = Full sun-sat at 23:10}FileSet {  Name = 'Catalog'  Include {    Options {      signature = MD5    }    File = '/var/spool/bacula/bacula.sql'  }}Client {  Name = bak-192.168.0.97  Address = 192.168.0.97  FDPort = 9102  Catalog = MyCatalog  Password = 'IYN0eZTw2BrRcA/MNGCwGHb9OrHDRykMMF8jSxtA7zUF'          # password for FileDaemon  File Retention = 15 days            # 60 days  Job Retention = 1 months            # six months  AutoPrune = yes                     # Prune expired Jobs/Files}Storage {  Name = windows-file# Do not use 'localhost' here  Address = 192.168.5.86                # N.B. Use a fully qualified name here  SDPort = 9103  Password = '4UMQ2b+Il8HiPxXotZLCzUhNfXasKRFlVOeOFNN0m5XS'  Device = FileChgr-windows  Media Type = File  Maximum Concurrent Jobs = 10        # run up to 10 jobs a the same time}Storage {  Name = linux-file# Do not use 'localhost' here  Address = 192.168.5.86                # N.B. Use a fully qualified name here  SDPort = 9103  Password = '4UMQ2b+Il8HiPxXotZLCzUhNfXasKRFlVOeOFNN0m5XS'  Device = FileChgr-linux  Media Type = File  Maximum Concurrent Jobs = 10        # run up to 10 jobs a the same time}Catalog {  Name = MyCatalog  dbname = 'bacula'; dbuser = 'bacula'; dbpassword = 'www.myj123.com'}Pool {  Name = Default  Pool Type = Backup  Recycle = yes                       # Bacula can automatically recycle Volumes  AutoPrune = yes                     # Prune expired volumes  Volume Retention = 30 days         # one year  Maximum Volume Bytes = 150G          # Limit Volume size to something reasonable  Maximum Volumes = 100               # Limit number of Volumes in Pool}Pool {  Name = File  Pool Type = Backup  Recycle = yes                       # Bacula can automatically recycle Volumes  AutoPrune = yes                     # Prune expired volumes  Volume Retention = 30 days         # one year  Maximum Volume Bytes = 150G          # Limit Volume size to something reasonable  Maximum Volumes = 100               # Limit number of Volumes in Pool  Label Format = 'Vol-'               # Auto label}pool{  Name = full-pool  Pool Type = Backup  Recycle = yes  AutoPrune = yes  Maximum Volume Jobs = 1  Volume Retention = 15 days  Maximum Volumes = 30  Label Format = 'Full-${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}-id${JobId}'}pool{  Name = diff-pool  Pool Type = Backup  Recycle = yes  AutoPrune = yes  Maximum Volume Jobs = 1  Volume Retention = 30 days  Maximum Volumes = 60  Label Format = 'Diff-{Year}-${Month:p/2/0/r}-${Day:p/2/0/r}-id${JobId}'}pool{  Name = inc-pool  Pool Type = Backup  Recycle = yes  AutoPrune = yes  Maximum Volume Jobs = 6  Volume Retention = 20 days  Maximum Volumes = 150  Maximum Volume Bytes = 200G  Label Format = 'Inc-${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}-id${JobId}'}# Scratch pool definitionPool {  Name = Scratch  Pool Type = Backup}

2.2 配置bacula-sd.conf

Device {  Name = FileChgr-windows  Media Type = File  Archive Device = /backup/windows  LabelMedia = yes;                   # lets Bacula label unlabeled media  Random Access = Yes;  AutomaticMount = yes;               # when device opened, read it  RemovableMedia = no;  AlwaysOpen = no;  Maximum Concurrent Jobs = 5}Device {  Name = FileChgr-linux  Media Type = File  Archive Device = /backup/linux  LabelMedia = yes;                   # lets Bacula label unlabeled media  Random Access = Yes;  AutomaticMount = yes;               # when device opened, read it  RemovableMedia = no;  AlwaysOpen = no;  Maximum Concurrent Jobs = 5}

三、图形界面配置

    bacula默认的安装是字符界面(其实也有基于QT环境的GUI界面,考虑性能和所依赖的安装包太多,没有使用)。第三方的工具有基于WEB的界面报告,基本上可以满足日常需要。

wKioL1eESMjzjS4rAADzLfi1wcg432.png-wh_50 

3.1 安装相关组件

yum install httpd php php-gd php-gettext php-mysql php-pdosystemctl enable httpd.servicesystemctl start httpd.servicefirewall-cmd --permanent --add-port=80/tcpfirewall-cmd --reloadcd /var/www/htmlcurl -O http://www./files//downloads/bacula-web-latest.tgzmkdir -v /var/www/html/baculatar -xzf bacula-web-latest.tgz -C /var/www/html/baculachown -Rv apache: /var/www/html/baculacd application/configcp -v config.php.sample config.phpchown -v apache: config.php

3.2 配置文件

vi config.php
$config['language'] = 'en_EN';$config[0]['label'] = 'Backup Server';$config[0]['host'] = 'localhost';$config[0]['login'] = 'bacula';$config[0]['password'] = 'verystrongpassword';$config[0]['db_name'] = 'bacula';$config[0]['db_type'] = 'mysql';$config[0]['db_port'] = '3306';
vi /etc/php.ini
date.timezone = Asia/Shanghaivim /etc/httpd/conf.d/bacula.conf

wKiom1eESSnThI1DAACffHtAlLs872.png-wh_50

3.3 测试

wKiom1eESVPCkQ05AAEb_oC4tsA802.png-wh_50

wKioL1eESVPCr9sXAADXtvuPoRI471.png-wh_50




企业级的开源备份工具Bacula之配置        http://waringid.blog.51cto.com/65148/1793512

企业级的开源备份工具Bacula之安装        http://waringid.blog.51cto.com/65148/1792007

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多