bareos主要由主控端和客戶端構成:
包含的重要的服務有:
bareos-director
bareos-storage
bareos-filedaemon
bareos-bconsole
bareos-database
bareos安裝
安裝bareos yum源:
wget -O /etc/yum.repos.d/bareos.repo http://download.bareos.org/bareos/release/latest/CentOS_6/bareos.repo
yum install bareos bareos-database-mysql
/usr/lib/bareos/scripts/create_bareos_database/usr/lib/bareos/scripts/make_bareos_tables/usr/lib/bareos/scripts/grant_bareos_privileges
/etc/init.d/bareos-dir start # Director進程,邏輯控制/etc/init.d/bareos-sd start # Storage Daemon/etc/init.d/bareos-fd start # File Daemon
bconsole
- 常用的命令有:
show filesetsstatus dirstatus clientstatus storagestatus schedulerun #運行run命令開始執行備份任務quit
安裝Bareos Webui
- CentOS 7上安裝可參考:http://blog.topspeedsnail.com/archives/8404
System requirements
- A working Bareos environment, Bareos >= 16.2. The Bareos Director and Bareos Webui should have the same version.
- You can install Bareos Webui on any host it does not have to be installed on the same as the Bareos Director.
- An Apache 2.x Webserver with mod-rewrite, mod-php5 and mod-setenv enabled.
- PHP >= 5.5
yum install httpd php php-cli php-common
cd /var/www/html/
wget https://codeload.github.com/bareos/bareos-webui/zip/master -O bareos-webui.zipunzip bareos-webui.zip
mv bareos-webui-master bareos-webuicp bareos-webui/install/apache/bareos-webui.conf /etc/httpd/conf.d/
修改bareos-webui.conf文件
/etc/init.d/httpd restart
onfigure the directors
mkdir /etc/bareos-webui cp /var/www/html/bareos-webui/install/directors.ini /etc/bareos-webui/
Configure the webui
cp /var/www/html/bareos-webui/install/configuration.ini /etc/bareos-webui/
Create restricted named consoles
cp /var/www/html/bareos-webui/install/bareos/bareos-dir.d/console/admin.conf.example /etc/bareos-webui/admin.conf
cp /var/www/html/bareos-webui/install/bareos/bareos-dir.d/profile/webui-admin.conf /etc/bareos-webui/
console配置文件/etc/bareos-webui/admin.conf
profile resource配置文件/etc/bareos-webui/webui-admin.conf
修改/etc/bareos/bareos-dir.d/director/bareos-dir.conf文件,在最后添加如下兩行
@/etc/bareos-webui/admin.conf
@/etc/bareos-webui/webui-admin.conf
/etc/init.d/bareos-dir restart
登錄web頁面:http://IP/bareos-webui
手動測試備份任務
查看備份文件
測試恢復
默認恢復到/tmp/bareos-restores,可以輸入mod自定義位置
查看恢復的文件
恢復單個文件
如果有多個文件可以寫個列表,使用<符號導入
restore client=client1 file=</tmp/file-list
增加bareos-filedaemon客戶端
在新的服務安裝bareos-filedaemon
yum install -y bareos-filedaemon
在bareos-director服務器執行如下命令
bconsole
*configure add client name=node2 address=172.17.20.124 password=secret
會創建如下兩個文件
/etc/bareos/bareos-dir-export/client/node2/bareos-fd.d/director/bareos-dir.conf
/etc/bareos/bareos-dir.d/client/node2.conf
從bareos-director上拷貝文件到新的bareos-filedaemon服務器
scp /etc/bareos/bareos-dir-export/client/node2/bareos-fd.d/director/bareos-dir.conf node2:/etc/bareos/bareos-fd.d/director/
scp /etc/bareos/bareos-dir.d/client/node2.conf node2:/etc/bareos/bareos-dir.d/client/
在bareos-director服務器上執行
*reload
在新的bareos-client啟動服務
service bareos-fd start
查看bareos-fd命令
bareos-fd -xc
在web頁面上查看客戶端
使用新的client運行一個job
查看node2的狀態
預估備份情況
運行備份job
列出備份的文件
查看存儲卷
在web頁面上查看所做的操作
備份相關配置
定義要備份的文件或目錄(高級的定義寫法請參考官方文檔)
/etc/bareos/bareos-dir.d/fileset/SelfTest.conf配置文件
例如:
定義備份的時間表(高級的時間表寫法可以參考官方文檔)
/etc/bareos/bareos-dir.d/schedule/WeeklyCycle.conf配置文件
例如:
AfterBackup時間表
/etc/bareos/bareos-dir.d/schedule/WeeklyCycleAfterBackup.conf配置文件
例如:
定義備份存放的路徑
/etc/bareos/bareos-sd.d/device/FileStorage.conf配置文件
例如:
Job和Jobdefs路徑
/etc/bareos/bareos-dir.d/job/
/etc/bareos/bareos-dir.d/jobdefs/DefaultJob.conf #默認job定義
存儲定義的路徑
/etc/bareos/bareos-dir.d/storage/
console和profile權限路徑
/etc/bareos/bareos-dir.d/console/
/etc/bareos/bareos-dir.d/profile/
添加自定義fileset
/etc/bareos/bareos-dir.d/fileset/my.conf
使用命令行*configure add fileset name=my,或者重啟/etc/init.d/bareos-dir restart使其生效。
使用show fileset查看
添加自定義jobdefs
/etc/bareos/bareos-dir.d/jobdefs/My.conf
使用命令行*configure add jobdefs name=My,或者重啟/etc/init.d/bareos-dir restart使其生效。
使用show jobdefs查看
添加自定義job
/etc/bareos/bareos-dir.d/job/my-job.conf
重啟/etc/init.d/bareos-dir restart
添加自定義schedule
/etc/bareos/bareos-dir.d/schedule/DailyCycle.conf
重啟/etc/init.d/bareos-dir restart
查看自定義備份是否運行成功
定義備份保留時間
/etc/bareos/bareos-dir.d/pool/Full.conf
Volume Retention = 365 days
添加備份情況郵件提醒
/etc/bareos/bareos-dir.d/messages/Standard.conf
重啟/etc/init.d/bareos-dir restart
Copy or Migration
遷移數據,從一個Volume移動到另一個Volume。(具體用法可參考官方文檔)
安裝 bareos-storage-tape
相關配置文件:
/etc/bareos/mtx-changer.conf
/etc/bareos/bareos-sd.d/autochanger/autochanger-0.conf
/etc/bareos/bareos-sd.d/device/tapedrive-0.conf
插件使用
可以配合一些插件備份數據
例如:
MySQL Plugin
Backup of MySQL Databases using the Bareos MySQL Percona xtrabackup Plugin
1.Install the xtrabackup tool from Percona
2.Install the files BareosFdPercona.py and bareos-fd-percona.py in your Bareos plugin directory
https://github.com/bareos/bareos-contrib/tree/master/fd-plugins/bareos_percona
3.Configuration Activate your plugin directory in the fd resource conf on the client
編輯bareos-fd.d/client/mysql-fd.conf
Client {
Name = mysql-fd
#...
Plugin Directory = /usr/lib64/bareos/plugins
Plugin Name = "python"
}
編輯bareos-dir.d/fileset/mysql.conf
FileSet {
Name = "mysql"
Include {
Options {
compression=GZIP
signature = MD5
}
File = /etc
#...
Plugin = "python:module_path=/usr/lib64/bareos/plugins:module_name=bareos-fd-percona"
}
}
其他插件 bpipe plugin,LDAP Plugin,VMware Plugin等用法可參考官方文檔。
加密(具體可參考官方文檔)
傳輸加密
修改bareos-dir.conf
修改bareos-fd.conf
修改bareos-sd.conf
數據加密
修改bareos-fd.conf
由於圖片地址用的公司的,現提供PDF文件:
https://files.cnblogs.com/files/wsl222000/%E4%BD%BF%E7%94%A8bareos%E5%A4%87%E4%BB%BD.pdf