1. Bacula Client安裝配置
1.1. linux客戶端安裝
1.1.1. 安裝依賴包
yum install libacl libacl-devel
1.1.2. Client安裝
tar zxf bacula-9.2.2.tar.gz
cd bacula-9.2.2
CFLAGS="-g -Wall" ./configure \
--sbindir=/usr/local/bacula/bin \
--sysconfdir=/usr/local/bacula/etc \
--with-pid-dir=/usr/local/bacula/working \
--with-subsys-dir=/usr/local/bacula/working \
--with-working-dir=/usr/local/bacula/working \
--enable-client-only
make&&make install&&make install-autostart-fd
1.1.3. Client配置
vi /usr/local/bacula/etc/bacula-fd.conf
Director {
Name = server-dir
# 此Name為Director的名稱,即server端名稱而非client的名稱。
Password = "3ydivk+gipxRjqbNCdwUeNi8ZWhGh3NXyvHXPZLAgMZ1"
# 定義client的密碼,director需要通過此密碼連接客戶端
}
Director {
Name = server-mon
# 此Name為tray-monitor的名稱,即monitor的名稱而非client的名稱。
Password = "w1yPbENlbfCMNrsD2gMarzBfLb+I1+kRN/UhUM3s5+VB"
# 配置 tray-monitor監控密碼,詳見《Tray Monitor服務》。。
Monitor = yes
1.1.4. Client啟動
cd /usr/local/bacula/bin
./bacula start
1.2. Windows客戶端安裝
1.2.1. Client安裝
選擇自定義安裝

選擇Client即可(console可以查看服務端備份任務的狀態等,可以不用安裝)

輸入Client端信息(Name:client名稱、port:默認9102、Max Jobs:默認10、Password:在服務端的dir配置文件中查看Client的password)

DIR配置(用於查看備份job信息,可以不配置)
(DIR Name:服務端DIR、DIR:9101默認端口、DIR Password:在服務端的dir或bconsole配置文件中查看password、DIR Address:DIR地址)

1.2.2. Client配置
安裝完成后,默認配置默認位於C:\Program Files\Bacula ,配置文件為bacula-fd.conf


配置文件中:
Director {
Name = bacula9-dir
Password = "3Kr1keeYcx6+uTO2sex17fT0D6ht6wTVIblPiihxfBtU"
}
# 此處配置為允許哪個Director連接此客戶端。
# Name為Server Director的name,Password為Director定義的該Client密碼。
# Send all messages except skipped files back to Director
Messages {
Name = Standard
director = bacula9-dir = all, !skipped, !restored
}
# Restricted Director, used by tray-monitor to get the
# status of the file daemon
Director {
Name = desktop-d3xfd32-mon
# 此Name為tray-monitor的名稱,即monitor的名稱而非client的名稱。
Password = "mDDIpbaqqkJvnFIXBTR00vJZqsE6dXjWR3GE6s8/0DTp"
# 配置 tray-monitor監控密碼,詳見《Tray Monitor服務》。。
Monitor = yes
}
1.2.3. Client啟動
配置完成后可檢測配置文件是否有誤
C:\Users\sky>cd C:\Program Files\Bacula
C:\Program Files\Bacula>bacula-fd.exe -c "C:\Program Files\Bacula\bacula-fd.conf"

查看客戶端服務狀態

1.3. 通過bacula-dir.conf創建新備份(Server端)
vi bacula-dir.conf
… …
1.3.1. 添加備份計划
Schedule {
Name = "schedule1"
Run = Level=Full sun at 0:00
Run = Level=Incremental hourly at 0:00
}
1.3.2. 添加備份Pool
Pool {
Name = Pool1
Pool Type = Backup
Recycle = yes # Bacula can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 365 days # one year
Maximum Volume Bytes = 50G # Limit Volume size to something reasonable
Maximum Volumes = 100 # Limit number of Volumes in Pool
Label Format = "backup-"
}
1.3.3. 添加Client
# linux client
Client{
Name = "linux-fd"
Address = linuxip
FDPort = 9102
Catalog = MyCatalog
Password = "yn2FnKAoucIbFMLtESgdARYmFUvqjuPYITyeLKwDwd9k"
}
# windows client
Client{
Name = "windows-fd"
Address = windowsip
FDPort = 9102
Catalog = MyCatalog
Password = "Hl0eg0yNSOQr/hS3j1RFXlPdziSJRgft5EIp7KUkxrH+"
}
1.3.4. 定義需要備份的目錄
# For linux
FileSet {
Name = "FileSet1"
Include {
Options {
signature = MD5
Compression = GZIP
}
File = /var/log/
}
}
# For windows
FileSet {
Name = "FileSet2"
Include {
Options {
signature = MD5
Compression = GZIP
}
File = "C:/myfiles"
}
}
1.3.5. 添加備份任務
# linux job
Job {
Name = "linux-backup1"
JobDefs = "DefaultJob"
Type = Backup
Client = "linux-fd"
FileSet = "FileSet1"
Storage = File1
Pool = Pool1
Schedule = "Schedule1"
}
Job {
Name = "linux-restores1"
Type = Restore
Client = "linux-fd"
FileSet = "FileSet1"
Storage = File1
Pool = Pool1
Messages = Standard
Where = /tmp
}
# windows job
Job {
Name = "windows-backup1"
JobDefs = "DefaultJob"
Type = Backup
Client = "windows-fd"
FileSet = "FileSet2"
Storage = File1
Pool = Pool1
Schedule = "Schedule1"
}
Job {
Name = "windows-restores1"
Type = Restore
Client = "windows-fd"
FileSet = "FileSet2"
Storage = File1
Pool = Pool1
Messages = Standard
Where = "c:/tmp"
}
1.4. 通過baculum-web創建新備份(需要安裝Bacula-gui,后面會介紹)
1.4.1. 添加client

密碼為client端定義的密碼,登錄client,查看該fd密碼。
vi /usr/local/bacula/etc/bacula-fd.conf
#
Director {
Name = server-dir
Password = "7oV+FkA+JLKw1DtYOevB+CKAjHvfuGPctgtvLyHf9dji"
# client密碼為該密碼
}
1.4.2. 添加Fileset
Fileset定義需要備份的內容

1.4.3. 添加Schedule
Name:不能使用中文(通過界面創建schedule功能不全,建議通過bacula-dir.conf配置)
每月第一周周六晚上23:00

1.4.4. 添加job
1.4.4.1. 添加備份任務
Name:最好能從名字確定系統和備份類型(如:centos01-backup、windows01-restore)
Type:選擇備份類型
Storage:選擇File1
Pool:選擇默認的File
Client:選擇剛創建的client
Fileset:選擇剛創建需要備份的目錄

1.4.4.2. 添加restore任務
Name:最好能從名字確定系統和備份類型(如:centos01-backup、windows01-restore)
Type:選擇備份類型(此處是restore)
Storage:選擇File1
Pool:選擇默認的File
Client:選擇剛創建的client
Fileset:選擇備份的那個目的fileset

1.4.5. 運行備份job
在Jobs中選中需要運行的job,單擊Run job

Job配置Storage為File1,在運行的時候如果選擇File2是無效的,備份還是保存在File1中。

在Dashboard中查看完成的任務

1.4.6. 運行還原job
選擇備份任務

選擇restore

選擇需要還原的文件

選擇還原位置(默認為restore任務中配置的還原位置)

選擇restore job

