Bacula検証

2017/08/23
Baculaアップデートによる動作不具合と対応方法を追記しました。

動作検証

バックアップ対象ディレクトリ

Baculaクライアントに下記ファイル/ディレクトリ構成を配置
# ls -lR /tmp/bktest
/tmp/bktest:
合計 8
-rw-r--r--. 1 root root  8 11月 27 02:30 example.log
drwxr-xr-x. 2 root root 20 11月 27 02:32 exclude_dir
-rw-r--r--. 1 root root  5 11月 27 02:30 test.log
drwxr-xr-x. 2 root root 22 11月 27 02:31 test_dir
/tmp/bktest/exclude_dir:
合計 4
-rw-r--r--. 1 root root 8 11月 27 02:32 exc.log
/tmp/bktest/test_dir:
合計 4
-rw-r--r--. 1 root root 10 11月 27 02:31 test2.txt
# cat /tmp/bktest/test.log
test
[root@bacula-client tmp]# cat /tmp/bktest/test_dir/test2.txt
test text
~

バックアップ対象指定

/etc/bacula/bacula-dir.confファイル内の記載内容から抜粋
~
FileSet {
Name = "Full Set"
Include {
Options {
signature = MD5
}
~
File = /tmp/bktest (バックアップ対象パスを指定)
}
~
Exclude {
File = /tmp/bktest/exclude_dir (バックアップ対象外パスを指定)
File = /tmp/bktest/example.log
}
}

~

バックアップとリストア

GUI(Baculum)操作

http://<サーバアドレス>:9095 へブラウザアクセスします。

gui1

認証後のTopページからWorkplaceを選択します。

 

gui2Run Jobアイコンを押下します。

 

gui3

ジョブの種類、設定を選択し、Run Jobを押下します。

 

gui4

ジョブの稼働ログが表示されます。

Termination:            Backup OK

と表示されているのでジョブは正常終了しています。

 

続いてリストアジョブを作成します。

gui5Restoreアイコンを押下します。

 

restore_wizard4

左ウィンドウのバックアップデータからリストア対象を右下ウィンドウにドラッグします。

 

restore_wizard5

リストア先サーバとディレクトリパスを指定します。

 

restore_wizard6

リストアファイルの衝突設定と優先度を指定します。

 

restore_wizard7

最終確認をします。

 

restore_wizard8

リストアジョブの稼働ログが表示されます。

Termination:            Restore OK

と表示されているのでジョブは正常終了しています。

 

Baculaクライアントのリストアデータを確認
# ls -l /tmp
合計 4
drwxr-xr-x. 3 root root  16 11月 28 02:54 bacula-restores
drwxr-xr-x. 4 root root  72 11月 27 02:30 bktest
-rwx------. 1 root root 827 11月 27 01:48 ks-script-oD_Tuc
drwxr-xr-x. 3 root root  16 11月 28 04:15 restore_tmp
-rw-------. 1 root root   0 11月 27 01:30 yum.log
# ls -lR restore_tmp
restore_tmp:
合計 0
drwxr-xr-x. 3 root root 19 11月 28 04:15 tmp
restore_tmp/tmp:
合計 0
drwxr--r--. 2 root root 21 11月 28 04:15 bktest
restore_tmp/tmp/bktest:
合計 4
-rw-r--r--. 1 root root 5 11月 27 02:30 test.log
# cat /tmp/bktest/test.log
test
#

設定した通りにバックアップ、リストアされていることが確認できました。
 

CUI(Bacula bconsole)操作

baculaサーバからコマンドアクセス

# bconsole

Connecting to Director localhost:9101
1000 OK: 102 bacula-dir Version: 7.4.4 (20 September 2016)
Enter a period to cancel a command.
*show filesets (ジョブのバックアップ対象確認)
FileSet: name=Full Set
O M
N
I /tmp/bktest (バックアップ対象)
N
E /tmp/bktest/exclude_dir (除外対象)
E /tmp/bktest/example.log (除外対象)
N
FileSet: name=Catalog
O M
N
I /var/spool/bacula/bacula.sql
N
*run

Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
A job name must be specified.
The defined Job resources are:
1: FullBackup
2: IncrementalBackup
3: BackupCatalog
4: RestoreFiles
Select Job resource (1-4): 1 (FullBackupを実行)
Run Backup job
JobName:  FullBackup
Level:    Full
Client:   bacula-client
FileSet:  Full Set
Pool:     File (From Job resource)
Storage:  File1 (From Job resource)
When:     2016-11-28 02:17:32
Priority: 10
OK to run? (yes/mod/no): yes (yesで即時実行)
Job queued. JobId=24
*status dir (directorでジョブ稼働状況を確認)
bacula-dir Version: 7.4.4 (20 September 2016) x86_64-redhat-linux-gnu redhat (Core)
Daemon started 28-11・016 00:44, conf reloaded 28-11月-2016 00:44:27
Jobs: run=4, running=1 mode=0
Heap: heap=270,336 smbytes=106,680 max_bytes=111,387 bufs=301 max_bufs=335
Scheduled Jobs:
Level          Type     Pri  Scheduled          Job Name           Volume
===================================================================================
Incremental    Backup    10  28-11・016 23:05  FullBackup         Vol-0001
Incremental    Backup    10  28-11・016 23:05  IncrementalBackup  Vol-0001
Full           Backup    11  28-11・016 23:10  BackupCatalog      Vol-0001
====
Running Jobs:
Console connected at 28-11・016 02:14
JobId  Type Level     Files     Bytes  Name              Status
======================================================================
24  Back Full          0         0  FullBackup        is waiting on Storage "File1" (ジョブ稼働中)
====
Terminated Jobs:
JobId  Level    Files      Bytes   Status   Finished        Name
====================================================================
~
23  Full          4        15   OK       28-11・016 02:17 FullBackup
====
*status dir (少し時間をおいて再実行)
bacula-dir Version: 7.4.4 (20 September 2016) x86_64-redhat-linux-gnu redhat (Core)
Daemon started 28-11・016 00:44, conf reloaded 28-11月-2016 00:44:27
Jobs: run=5, running=0 mode=0
Heap: heap=270,336 smbytes=103,052 max_bytes=112,306 bufs=282 max_bufs=335

Scheduled Jobs:
Level          Type     Pri  Scheduled          Job Name           Volume
===================================================================================
Incremental    Backup    10  28-11・016 23:05  FullBackup         Vol-0001
Incremental    Backup    10  28-11・016 23:05  IncrementalBackup  Vol-0001
Full           Backup    11  28-11・016 23:10  BackupCatalog      Vol-0001
====
Running Jobs:
Console connected at 28-11・016 02:14
No Jobs running.
====
Terminated Jobs:
JobId  Level    Files      Bytes   Status   Finished        Name
====================================================================
23  Full          4        15   OK       28-11・016 02:17 FullBackup
24  Full          4        15   OK       28-11・016 02:18 FullBackup (ジョブ成功)

====
*restore (リストアコマンド実行)
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.
To select the JobIds, you have the following choices:
1: List last 20 Jobs run
2: List Jobs where a given File is saved
3: Enter list of comma separated JobIds to select
4: Enter SQL list command
5: Select the most recent backup for a client
6: Select backup for a client before a specified time
7: Enter a list of files to restore
8: Enter a list of files to restore before a specified time
9: Find the JobIds of the most recent backup for a client
10: Find the JobIds for a backup for a client before a specified time
11: Enter a list of directories to restore for found JobIds
12: Select full restore to a specified Job date
13: Cancel
Select item:  (1-13):5 (直近のバックアップから選択)

Automatically selected Client: bacula-client
The defined FileSet resources are:
1: Catalog
2: Full Set
Select FileSet resource (1-2): 2
+-------+-------+----------+----------+---------------------+------------+
| JobId | Level | JobFiles | JobBytes | StartTime           | VolumeName |
+-------+-------+----------+----------+---------------------+------------+
|    24 | F     |        4 |       15 | 2016-11-28 02:17:48 | Vol-0001   |
+-------+-------+----------+----------+---------------------+------------+
You have selected the following JobId: 24
Building directory tree for JobId(s) 24 ...
2 files inserted into the tree.
You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.
cwd is: /
$ ls (UNIXライクなコマンド操作
tmp/
$ cd tmp
cwd is: /tmp/
$ ls
bktest/
$ cd bktest
cwd is: /tmp/bktest/
$ ls
test.log
test_dir/
$ cd test_dir
cwd is: /tmp/bktest/test_dir/
$ ls
test2.txt
$ pwd
cwd is: /tmp/bktest/test_dir/
$ mark test2.txt (リストア対象として選択
1 file marked.
$done
Bootstrap records written to /var/spool/bacula/bacula-dir.restore.1.bsr
Bootstrap records written to /var/spool/bacula/bacula-dir.restore.1.bsr

The Job will require the following (*=>InChanger):
Volume(s)                 Storage(s)                SD Device(s)
===========================================================================
Vol-0001                  File1                     FileChgr1
Volumes marked with "*" are in the Autochanger.
1 file selected to be restored.
Using Catalog "MyCatalog"
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/spool/bacula/bacula-dir.restore.1.bsr
Where:           /tmp/bacula-restores
Replace:         Always
FileSet:         Full Set
Backup Client:   bacula-client
Restore Client:  bacula-client
Storage:         File1
When:            2016-11-28 02:53:57
Catalog:         MyCatalog
Priority:        10
Plugin Options:
OK to run? (yes/mod/no): yes
Job queued. JobId=25
You have messages.
*status dir
bacula-dir Version: 7.4.4 (20 September 2016) x86_64-redhat-linux-gnu redhat (Core)
Daemon started 28-11・016 00:44, conf reloaded 28-11月-2016 00:44:27
Jobs: run=6, running=0 mode=0
Heap: heap=184,320 smbytes=86,271 max_bytes=1,250,185 bufs=280 max_bufs=335
Scheduled Jobs:
Level          Type     Pri  Scheduled          Job Name           Volume
===================================================================================
Incremental    Backup    10  28-11・016 23:05  FullBackup         Vol-0001
Incremental    Backup    10  28-11・016 23:05  IncrementalBackup  Vol-0001
Full           Backup    11  28-11・016 23:10  BackupCatalog      Vol-0001
====
Running Jobs:
Console connected at 28-11・016 02:46
No Jobs running.
====
Terminated Jobs:
JobId  Level    Files      Bytes   Status   Finished        Name
====================================================================
~
23  Full          4        15   OK       28-11・016 02:17 FullBackup
24  Full          4        15   OK       28-11・016 02:18 FullBackup
25  Restore        1        10   OK       28-11・016 02:54 RestoreFiles
====
*

Baculaクライアントのリストアデータを確認
# ls -l /tmp
合計 4
drwxr-xr-x. 3 root root  16 11月 28 02:54 bacula-restores
drwxr-xr-x. 4 root root  72 11月 27 02:30 bktest
-rwx------. 1 root root 827 11月 27 01:48 ks-script-oD_Tuc
-rw-------. 1 root root   0 11月 27 01:30 yum.log
#
ls -lR bacula-restores
bacula-restores:
合計 0
drwxr-xr-x. 3 root root 19 11月 28 02:54 tmp
bacula-restores/tmp:
合計 0
drwxr-xr-x. 3 root root 21 11月 28 02:54 bktest
bacula-restores/tmp/bktest:
合計 0
drwxr--r--. 2 root root 22 11月 28 02:54 test_dir
bacula-restores/tmp/bktest/test_dir:
合計 4
-rw-r--r--. 1 root root 10 11月 27 02:31 test2.txt
# cat /tmp/bktest/test_dir/test2.txt
test text
#
設定した通りにバックアップ、リストアされていることが確認できました。

以上で検証は終了です。


まとめ

Baculaを導入する際の注意点や気付いたこと。

・クライアントやジョブの定義変更はConfigファイルの修正が必要なのでユーザフレンドリーな仕様ではない。

・ストレージにもサービス(bacula-sd)導入が必要なので、OSがないNASに保存するにはマウント処理等が必要です。

公式ホームページはユーザ向けマニュアルが充実していないのでコミュニティサイトの情報を活用しましょう。

・Baculum(GUI)はhttpdを使用するためSELinuxでブロックされることが多く、調整または無効化が必要です。

・Baculum(GUI)の認証画面はPopup形式であり、使用ブラウザによってはブロックされるので許可設定が必要です。

・bconsole(CUI)ではフェーズ移行中のジョブは表示されないことがあります。少し時間をおいてstatusコマンドを叩いてみましょう。

・バックアップデータの圧縮、暗号化、テープドライブとの連携、ジョブ結果のメール通知、改ざん検知及び復旧など、機能としては商用製品と遜色ありません。

今回の検証ではそれらの機能まで検証していませんが、いずれレポートできればと思います。

導入~操作を覚えるまでのハードルは少し高いですが、そこを越えれば長く使い続けられるソフトだと感じました。