22. Baculaインストール
22
以下のパッケージがインストールされていることを確認します。
Baculaサーバ
$ dpkg –l | grep bacula
ii bacula-client 5.2.6+dfsg-9.1ubuntu3
ii bacula-common 5.2.6+dfsg-9.1ubuntu3
ii bacula-common-mysql 5.2.6+dfsg-9.1ubuntu3
ii bacula-console 5.2.6+dfsg-9.1ubuntu3
ii bacula-director-common 5.2.6+dfsg-9.1ubuntu3
ii bacula-director-mysql 5.2.6+dfsg-9.1ubuntu3
ii bacula-fd 5.2.6+dfsg-9.1ubuntu3
ii bacula-sd 5.2.6+dfsg-9.1ubuntu3
ii bacula-sd-mysql 5.2.6+dfsg-9.1ubuntu3
ii bacula-server 5.2.6+dfsg-9.1ubuntu3
ii bacula-traymonitor 5.2.6+dfsg-9.1ubuntu3
※一部パッケージ名以外の表示結果を省略しています。
23. Baculaインストール
23
以下のパッケージがインストールされていることを確認します。
Baculaサーバ
$ dpkg –l | grep mysql
ii bacula-common-mysql 5.2.6+dfsg-9.1ubuntu3
ii bacula-director-mysql 5.2.6+dfsg-9.1ubuntu3
ii bacula-sd-mysql 5.2.6+dfsg-9.1ubuntu3
ii libdbd-mysql-perl 4.025-1
ii libmysqlclient18:amd64 5.5.43-0ubuntu0.14.04.1
ii mysql-client-5.5 5.5.43-0ubuntu0.14.04.1
ii mysql-client-core-5.5 5.5.43-0ubuntu0.14.04.1
ii mysql-common 5.5.43-0ubuntu0.14.04.1
ii mysql-server 5.5.43-0ubuntu0.14.04.1
ii mysql-server-5.5 5.5.43-0ubuntu0.14.04.1
ii mysql-server-core-5.5 5.5.43-0ubuntu0.14.04.1
※一部パッケージ名以外の表示結果を省略しています。
37. Bacula設定
37
/etc/bacula/bacula-dir.conf
# Client (File Services) to backup
Client {
Name = Bacula-fd
Address = 192.168.0.151
FDPort = 9102
Catalog = MyCatalog
Password = “bacula“ # password for FileDaemon
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
バックアップ対象機を指定します。
ここでは上記のようにリソースごと追加します。
38. Bacula設定
38
/etc/bacula/bacula-dir.conf
Storage {
Name = File
# Do not use "localhost" here
Address = 192.168.0.150 # N.B. Use a fully qualified name here
SDPort = 9103
Password = “bacula"
Device = FileStorage
Media Type = File
}
ここではバックアップの保存先のサーバを指定します。
今回の構築ではDirectorデーモンとStorageデーモンは同じサーバにイ
ンストールしていますので「192.168.0.150」を指定します。
48. Bacula設定
48
/etc/bacula/bacula-fd.conf
Director {
Name = Bacula-dir
Password = " bacula"
}
Director {
Name = Bacula-mon
Password = " bacula"
Monitor = yes
}
FileDaemon { # this is me
Name = Bacula-fd
FDport = 9102 # where we listen for the director
WorkingDirectory = /var/lib/bacula
Pid Directory = /var/run/bacula
Maximum Concurrent Jobs = 20
FDAddress = 192.168.0.151
}
Messages {
Name = Standard
director = Bacula-dir = all, !skipped, !restored
}
各NameとパスワードをBaculaサーバ側で設
定した値に合わせます。
バックアップ対象サーバのIPアドレスを指定しま
す。
57. バックアップ
57
$ sudo bconsole
Connecting to Director localhost:9101
1000 OK: Bacula Version: 5.2.6 (21 February 2012)
Enter a period to cancel a command.
*
まずbconsole起動を起動します。
コマンドプロンプトが「*」に変わったことを確認します。
58. バックアップ
58
Labelを作成します。labelコマンドで作成します。
*label
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
Automatically selected Storage: File
Enter new Volume name: bacula ←label名を入力
Defined Pools:
1: Default
2: File
3: Scratch
Select the Pool (1-3): 2 ←2を選択する
Connecting to Storage daemon File at 192.168.0.150:9103 ...
Sending label command for Volume “bacula" Slot 0 ...
3000 OK label. VolBytes=194 DVD=0 Volume=" bacula "
Device="FileStorage" (/BackupDATA)
Catalog record for Volume " bacula", Slot 0 successfully created.
Requesting to mount FileStorage ...
3906 File device "FileStorage" (/ BackupDATA) is always mounted.
59. バックアップ
59
*run ←runを入力
A job name must be specified.
The defined Job resources are:
1: JOB-Ubuntu
2: BackupClient1
3: BackupCatalog
4: RestoreFiles
Select Job resource (1-4): 1 ←実行するJobを選択
Run Backup job
JobName: JOB-Ubuntu
Level: Full
Client: bacula-fd
FileSet: Full Set
Pool: File (From Job resource)
Storage: File (From Job resource)
When: 2015-05-25 14:47:15
Priority: 10
OK to run? (yes/mod/no): yes ←yesを入力
バックアップ実行します。Runコマンドでバックアップを取得します。
60. バックアップ
60
*status
Status available for:
1: Director
2: Storage
3: Client
4: Scheduled
5: All
Select daemon type for status (1-5): 1 ←1を選択
(省略)
Terminated Jobs:
JobId Level Files Bytes Status Finished Name
===============================================
1 Full 29,971 896.0 M OK 25- 5・015 14:49 JOB-Ubuntu
バックアップ確認
実行したJobが「Terminated Jobs」になっていることを確認します。
63. リストア
63
$ sudo bconsole
Connecting to Director localhost:9101
1000 OK: 1 bacula-dir Version: 5.2.6 (21 February 2012)
Enter a period to cancel a command.
*
まずbconsoleを起動します。
コマンドプロンプトが「*」に変わったことを確認します。
64. リストア
64
* restore
(省略)
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 ←5を選択します。
リストアを実行します。
65. リストア
65
+-------+-------+----------+-------------+---------------------+------------+
| JobId | Level | JobFiles | JobBytes | StartTime | VolumeName |
+-------+-------+----------+-------------+---------------------+------------+
| 1 | F | 29,971 | 896,094,352 | 2015-05-25 14:47:19 | bacula |
+-------+-------+----------+-------------+---------------------+------------+
You have selected the following JobId: 1
Building directory tree for JobId(s) 1 ...
++++++++++++++++++++++++++++++++++++++++++++
26,641 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: /
$
「5」を選択すると自動的に以下のような画面になります。
コマンドプロンプトが「$」になるとリストアの準備が完了になります。
66. リストア
66
$ cd /etc/bacula
$ ls
bacula-fd.conf
$ mark bacula-fd.conf
1 file marked.
リストアするファイルをmarkコマンドで指定します。
対象のファイルがあるディレクトリに移動してmarkコマンドを実行します。
markコマンドは*などを使用して一括指定することも可能です。
/etc/bacula/bacula-fd.confをリストアします
67. リストア
67
$ done
Run Restore job
JobName: RestoreFiles
Bootstrap: /var/spool/bacula/bacula-dir.restore.1.bsr
Where: /tmp ←この場所にリストアされます。
Replace: always
FileSet: Full Set
Backup Client: bacula-fd
Restore Client: bacula-fd
Storage: File
When: 2015-05-25 14:55:46
Catalog: MyCatalog
Priority: 10
OK to run? (yes/mod/no): yes ←yesを入力します。
リストアを実行します。doneコマンドを実行します。
68. リストア
68
$ cd /tmp
$ ls
$ etc
$ cd cd etc/bacula/
$ ls
$ bacula-fd.conf
$
リストア確認をします。
バックアップ対象機でファイルを確認します。
bconsoleコマンドは必要ありません。