标签:iscsi freenas bacula 备份 磁盘柜 开源
一、iscsi网络存储
1.1 配置FreeNAS
考虑专业的磁盘柜价格不菲,而使用服务器的方式一方面磁盘容量有限,另一方面IO的性能也很难保障。FreeNAS是一套免费的NAS服务器,它能将一部普通PC变成网络存储服务器。用户可通过Windows、Macs、FTP、SSH 及网络文件系统 (NFS) 来访问存储服务器。
我们通过它来组建符合企业使用的备份存储设备,该系统具体的安装步骤可参考相关资源。这里通过启用iscsi功能实现网络备份存储,相关设置如下图。
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.199 node.session.auth.password = testtesttest discovery.sendtargets.auth.authmethod = CHAP#根据freenas的设置修改 discovery.sendtargets.auth.username = backup.myj discovery.sendtargets.auth.password = testtesttest
完成设置后通过以下指令查看配置和连接情况。
iscsiadm -m discovery -t sendtargets -p 192.168.5.199 iscsiadm -m node -o show
1.3 配置开机自动挂载
完成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.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
}三、图形界面配置
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
本文出自 “虚拟的现实” 博客,转载请与作者联系!
标签:iscsi freenas bacula 备份 磁盘柜 开源
原文地址:http://waringid.blog.51cto.com/65148/1825619