段階的に事を進める。
まずbconsoleを使って操作をするので、この設定から
「bacula-dir.conf」を下記のように修正
|
そして、「bconsole.conf」を下記のように修正.
|
これで「systemctl start bacula-dir」を稼働させればbconsoleが使える
[root@director ~]# systemctl start bacula-dir
[root@director ~]# bconsole
Connecting to Director localhost:9101
1000 OK: 103 bacula-dir Version: 9.0.6 (20 November 2017)
Enter a period to cancel a command.
*次にストレージ、バックアップ先を定義する。ここではVTLで定義した8巻オートローダーを使うことにする
まず「lsscsi -g」コマンドでデバイスを確認します。
[root@director ~]# lsscsi -g
[0:0:0:0] disk Msft Virtual Disk 1.0 /dev/sda /dev/sg0
[0:0:0:1] cd/dvd Msft Virtual DVD-ROM 1.0 /dev/sr0 /dev/sg1
[1:0:0:0] mediumx HPE HPE StoreEver 1/ 0105 /dev/sch0 /dev/sg3
[1:0:1:0] tape HPE Ultrium 6-SCSI 0105 /dev/st0 /dev/sg2
[root@director ~]#オートローダーの「Changer Device」は「/dev/sg3」、テープドライブは「/dev/st0」ではなく
巻き戻しなしの「/dev/nst0」を指定します。なので「/etc/bacula/bacula-sd.conf」は下記になる
Storage {
Name = bacula-sd
SDPort = 9103
WorkingDirectory = "/var/spool/bacula"
Pid Directory = "/var/run"
Plugin Directory = "/usr/lib64/bacula"
Maximum Concurrent Jobs = 1
}
Director {
Name = bacula-dir
Password = bacula-storage
}
Director {
Name = bacula-mon
Password = bacula-mon
Monitor = yes
}
Autochanger {
Name = HPE-StoreEver-1-8-G2
Device = LTO-6-Drive
Changer Command = "/usr/libexec/bacula/mtx-changer %c %o %S %a %d"
Changer Device = /dev/sg3
}
Device {
Name = LTO-6-Drive
Media Type = LTO-6
Archive Device = /dev/nst0
AutomaticMount = yes;
AlwaysOpen = yes;
RemovableMedia = yes;
RandomAccess = no;
Maximum File Size = 5GB
Changer Command = "/usr/libexec/bacula/mtx-changer %c %o %S %a %d"
Changer Device = /dev/sg3
AutoChanger = yes
Control Device = /dev/sg2
Alert Command = "/usr/libexec/bacula/tapealert %l"
}
Messages {
Name = Standard
director = bacula-dir = all
}バックアップされる対象を定義します。
ここではbacula-dirが稼働しているサーバとファイルサーバの2つのマシンに「bacula-client」パッケージをインストールして
「/etc/bacula/bacula-fd.conf」は共に下記のようにします。
Director {
Name = bacula-dir
Password = bacula-fd
}
Director {
Name = bacula-mon
Password = bacula-mon
Monitor = yes
}
FileDaemon {
Name = bacula-fd
FDport = 9102
WorkingDirectory = /var/spool/bacula
Pid Directory = /var/run
Maximum Concurrent Jobs = 20
Plugin Directory = /usr/lib64/bacula
}
Messages {
Name = Standard
director = bacula-dir = all, !skipped, !restored
}ここまではバックアップに必要な要素の定義でした。バックアップ対象(クライアント)とか実際のバックアップ先(storage)とか。
この「bacula-dir.conf」ではそれらの要素を使って実際のジョブを作ります。
バックアップ仕様
を定めたて、これらを組み合わせて「Job」を作り上げることになる
共通な項目を集めた「JobDefs」を定義して、上書き部分のみを「Job」で定義する事が可能
まずは「Client」から
バックアップ対象としては、バックアップサーバ自身とファイルサーバ(nfs.sybyl.local)とします.
バックアップサーバ自身はPostgreSQLに収めたカタログ情報をバックアップするのに必要です。
カタログ情報:どこに何があって、差分、増分バックアップの際、バックアップ対象かどうかの指標と成るデータかな。
Client {
Name = bacula-fd
Address = localhost
FDPort = 9102
Catalog = MyCatalog
Password = bacula-fd
File Retention = 60 days
Job Retention = 6 months
AutoPrune = yes
}
Client {
Name = nfs.sybyl.local
Address = nfs.sybyl.local
FDPort = 9102
Catalog = MyCatalog
Password = bacula-fd
File Retention = 60 days
Job Retention = 6 months
AutoPrune = yes
}バックアップされるファイルを定義します.
ここではファイルサーバ向けの「FileServerFullSet」とバックアップサーバ向けのカタログデータ採取の「Catalog」を定義します.
FileSet {
Name = home
Include {
Options {
signature = MD5
}
File = /home
}
Exclude {
File = /home/tmp
File = /home/sample
}
}
FileSet {
Name = Catalog
Include {
Options {
signature = MD5
}
File = "/var/spool/bacula/bacula.sql"
}
}「フル」「増分」「差分」のバックアップ形式とバックアップ開始時刻を定める。
「WeeklyCycle」は月の初めの日曜日に「フル」. それ以外の日曜日は「差分」. 月曜日から土曜日は「増分」で時刻は23:05
「Weekly」は毎週日曜日に「フル」. それ以外の曜日は「増分」で対応
「WeeklyCycleAfterBackup」はカタログ向けで毎日「フル」で対応
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 = Weekly
Run = Full sun at 23:05
Run = Incremental mon-sat at 23:05
}
Schedule {
Name = WeeklyCycleAfterBackup
Run = Full sun-sat at 23:10
}バックアップ先を定める
Autochanger {
Name = HPE-StoreEver-1-8-G2
Address = vtl.sybyl.local
SDPort = 9103
Password = bacula-storage
Device = HPE-StoreEver-1-8-G2
Media Type = LTO-6
Autochanger = yes
Maximum Concurrent Jobs = 1
}オートローダーなら左側のマガジンは「フル」専用として、右側は「差分」専用とかと定義して
テープメディアの用途を定める。bconsoleとかで事前にテープにラベル貼りを行います。
物理テープに張っているテープとは別のラベルでbacula内部で有効なラベルって感じかな
Pool {
Name = Full
Pool Type = Backup
Recycle = yes
AutoPrune = yes
Volume Retention = 1 months
Label Format = "Full-"
}
Pool {
Name = Inc
Pool Type = Backup
Recycle = yes
AutoPrune = yes
Volume Retention = 62 days
Label Format = "Inc-"
}そして最後に「job」を定める
Job {
Enabled = yes
Name = Backup-bacula-fd
Type = Backup
Client = bacula-fd
FileSet = HomeDirectory
Schedule = Weekly
Storage = HPE-StoreEver-1-8-G2
Messages = Standard
Full Backup Pool = Full
Incremental Backup Pool = Inc
Pool = Full
Write Bootstrap = "/var/spool/bacula/%c.bsr"
}
Job {
Enabled = yes
Name = Backup-nfs
Type = Backup
Client = nfs.sybyl.local
FileSet = HomeDirectory
Schedule = Weekly
Storage = HPE-StoreEver-1-8-G2
Messages = Standard
Full Backup Pool = Full
Incremental Backup Pool = Inc
Pool = Full
Write Bootstrap = "/var/spool/bacula/%c.bsr"
}
Job {
Name = "BackupCatalog"
Type = Backup
Client = bacula-fd
Level = Full
FileSet="Catalog"
Schedule = "WeeklyCycleAfterBackup"
Storage = HPE-StoreEver-1-8-G2
Messages = Standard
Pool = Full
RunBeforeJob = "/usr/libexec/bacula/make_catalog_backup.pl MyCatalog"
RunAfterJob = "/usr/libexec/bacula/delete_catalog_backup"
Write Bootstrap = "/var/spool/bacula/%n.bsr"
Priority = 11
}複雑なので文法チェックプログラムが用意されている
bacula-dir -tc /etc/bacula/bacula-dir.conf
bacula-sd -tc /etc/bacula/bacula-sd.conf
bacula-fd -tc /etc/bacula/bacula-fd.conf
bconsole -tc /etc/bacula/bconsole.confbconsoleでstatus表示する際、文字化けが起こる。「/etc/sysconfig/bacula-dir」を下記にすることで回避可能
DIR_USER=bacula
DIR_GROUP=bacula
LANG=CIBMのテープで lin_tape デーモンから /dev/IBMtape0 とかが用意されるが、このデバイスをBaculaで
使うとバックアップに失敗する事案があるみたい。
ここで作った設定ファイル
Bacula/configuration/bacula-dir.conf
Bacula/configuration/bacula-sd.conf
Bacula/configuration/bacula-fd.conf
Bacula/configuration/bconsole.conf
Bacula/configuration/bat.conf