1、iscsi網絡存儲php
1.1 配置FreeNAShtml
考慮專業的磁盤櫃價格不菲,而使用服務器的方式一方面磁盤容量有限,另外一方面IO的性能也很難保障。FreeNAS是一套免費的NAS服務器,它能將一部普通PC變成網絡存儲服務器。用戶可經過Windows、Macs、FTP、SSH 及網絡文件系統 (NFS) 來訪問存儲服務器。node
咱們經過它來組建符合企業使用的備份存儲設備,該系統具體的安裝步驟可參考相關資源。這裏經過啓用iscsi功能實現網絡備份存儲,相關設置以下圖。mysql
1.2 配置iscsi客戶端linux
iSCSI的服務器端已經在FreeNAS上完成配置,接下來須要在linux系統上完成客戶端的配置,實如今客戶端對網絡存儲的掛載。web
首先安裝相關的系統組件並完成配置文件的修改。sql
yum -y install iscsi-initiator-utils vi /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.2016-06.com.redhat:82367514497d#客戶端的標記
接下來修改主要的配置文件。apache
vi /etc/iscsi/iscsid.conf
node.session.auth.authmethod = CHAP#根據freenas的設置修改 node.session.auth.username = myj.5.199 node.session.auth.password = testtesttest discovery.sendtargets.auth.authmethod = CHAP#根據freenas的設置修改 discovery.sendtargets.auth.username = backup.myj discovery.sendtargets.auth.password = testtesttest
完成設置後經過如下指令查看配置和鏈接狀況。vim
iscsiadm -m discovery -t sendtargets -p 192.168.5.199 iscsiadm -m node -o show
1.3 配置開機自動掛載windows
完成iSCSI的配置後,接下來配置開機自動掛載及相應的服務自動啓動設定,具體系統分區操做略。
systemctl enable iscsid.service iscsiadm -m node -T iqn.2005-10.org.freenas.ctl:backu-10ttarget -p 192.168.5.199 --op update -n node.startup -v automatic Ls -l /dev/disk/by-uuid Blkid /dev/sdc1
2、備份存儲設置
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 definition Pool { 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 }
3、圖形界面配置
bacula默認的安裝是字符界面(其實也有基於QT環境的GUI界面,考慮性能和所依賴的安裝包太多,沒有使用)。第三方的工具備基於WEB的界面報告,基本上能夠知足平常須要。
3.1 安裝相關組件
yum install httpd php php-gd php-gettext php-mysql php-pdo systemctl enable httpd.service systemctl start httpd.service firewall-cmd --permanent --add-port=80/tcp firewall-cmd --reload cd /var/www/html curl -O http://www.bacula-web.org/files/bacula-web.org/downloads/bacula-web-latest.tgz mkdir -v /var/www/html/bacula tar -xzf bacula-web-latest.tgz -C /var/www/html/bacula chown -Rv apache: /var/www/html/bacula cd application/config cp -v config.php.sample config.php chown -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/Shanghai vim /etc/httpd/conf.d/bacula.conf
3.3 測試
企業級的開源備份工具Bacula之配置 http://waringid.blog.51cto.com/65148/1793512
企業級的開源備份工具Bacula之安裝 http://waringid.blog.51cto.com/65148/1792007