なんとかバックアップを取ることに成功したのでメモ。
baculaサーバ自身のバックアップです。
作業概要
設定ファイルを一回リストアした
- いかにも不要そうな設定は消して動かしてみたのですが、ストレージデーモンに接続できなくなってしまいました。
デフォルトのconfigをリストアしてパスワードのみ変えて動かしました。
- いかにも不要そうな設定は消して動かしてみたのですが、ストレージデーモンに接続できなくなってしまいました。
外部ストレージにアクセスできなかった
- baculaサーバはVMであがってます
- バックアップ先をホストの外部ストレージにしました。
しかしマウント、書き込みはOKだったのですがバックアップを開始するとプロセスが進まなかったので一旦ローカルに戻しました。
設定ファイルのメモ
公式マニュアルをに詳しくあると思いますが、一旦自分用のメモ
bacula-dir
job、jobdef
- バックアップのジョブ
- デフォルト(jobdef)から追記していくっぽい
Storage
- bacula-dirのStorageはlocalhostを設定しない
各ファイルデーモンはここの設定に見に行く
- bacula-dirのStorageはlocalhostを設定しない
Autochanger
- Storageのクラスタ?
設定しなくてもOKっぽい
- Storageのクラスタ?
Client
- バックアップ対象クライアントのIP指定
Fileset
bacula-sd
Autochanger
- Deviceのクラスタ?
- Nameがディレクタと紐づいているっぽい
Device
- バックアップファイル保存場所
- Filetypeはディレクタと紐づいている
bacula-fd
- 各クライアントに設定
バックアップ実行してみる
bconsoleでbaculaコンソールにはいってrunで実行します。
1は設定したバックアップクライアント、2はデータベースのバックアップのようです。
3は不明…
*run Automatically selected Catalog: MyCatalog Using Catalog "MyCatalog" A job name must be specified. The defined Job resources are: 1: BackupClient1 2: BackupCatalog 3: RestoreFiles Select Job resource (1-3): 1 Run Backup job JobName: BackupClient1 Level: Incremental Client: bacula-fd FileSet: Full Set Pool: File (From Job resource) Storage: File1 (From Job resource) When: 2018-06-05 20:00:00 Priority: 10 OK to run? (yes/mod/no): yes Job queued. JobId=32 You have messages. *
完了すると履歴に出ます。
日付のところが文字化けしてるけど何だろ?
あとErrorが出てるのは過去の失敗の履歴です。
*status dir bacula-dir Version: 9.0.6 (20 November 2017) x86_64-redhat-linux-gnu redhat (Core) Daemon started 05- 6��2018 18:56, conf reloaded 05- 6月-2018 18:56:52 Jobs: run=4, running=0 mode=0,0 Heap: heap=270,336 smbytes=142,664 max_bytes=185,328 bufs=335 max_bufs=389 Res: njobs=3 nclients=1 nstores=2 npools=3 ncats=1 nfsets=2 nscheds=2 Scheduled Jobs: Level Type Pri Scheduled Job Name Volume =================================================================================== Incremental Backup 10 05- 6��2018 23:05 BackupClient1 Vol-0019 Full Backup 11 05- 6��2018 23:10 BackupCatalog Vol-0019 ==== Running Jobs: Console connected at 05- 6��2018 19:59 No Jobs running. ==== Terminated Jobs: JobId Level Files Bytes Status Finished Name ==================================================================== 23 Full 0 0 Error 03- 6��2018 23:05 JOB-Bacula-ubuntu 24 Full 0 0 Error 03- 6��2018 23:05 BackupClient1 25 Full 0 0 Error 03- 6��2018 23:10 BackupCatalog 26 Full 0 0 Error 04- 6��2018 23:05 JOB-Bacula-ubuntu 27 Full 0 0 Error 04- 6��2018 23:05 BackupClient1 28 Full 0 0 Error 04- 6��2018 23:10 BackupCatalog 29 Full 0 0 Incomplete 05- 6��2018 19:18 BackupClient1 30 Full 0 0 Incomplete 05- 6��2018 19:32 BackupClient1 31 Full 0 0 Cancel 05- 6��2018 19:59 BackupClient1 32 Full 70,123 1.423 G OK 05- 6��2018 20:05 BackupClient1 # 先ほどの成功ログ ==== *
リストアしてみる
クライアントのリストアは5番を選択します。
対象クライアントは2番の自信です。
1は別のマシンなので今度バックアップからやります。
Full setで取ったファイルをリストアになるようです。
*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 Defined Clients: 1: PC-ubuntu-fd 2: bacula-fd Select the Client (1-2): 2 The defined FileSet resources are: 1: Catalog 2: Full Set Select FileSet resource (1-2): 2 +-------+-------+----------+---------------+---------------------+------------+ | JobId | Level | JobFiles | JobBytes | StartTime | VolumeName | +-------+-------+----------+---------------+---------------------+------------+ | 32 | F | 70,123 | 1,423,788,515 | 2018-06-05 20:00:05 | Vol-0019 | +-------+-------+----------+---------------+---------------------+------------+ You have selected the following JobId: 32 Building directory tree for JobId(s) 32 ... +++++++++++++++++++++++++++++++++++++++++ 57,724 files inserted into the tree.
続いて対象のファイルを選択します。
今回はbaculaのディレクトリをリストアしてみます。
configは私は作成した退避用ディレクトリです。
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: / $ cd /etc/ cwd is: /etc/ $ cd bacula cwd is: /etc/bacula/ $ ls bacula-dir.conf bacula-dir.conf.org bacula-fd.conf bacula-fd.conf.org bacula-sd.conf bacula-sd.conf.org bconsole.conf bconsole.conf.org config/ query.sql $
移動したらmarkします。
つけたファイルのみリストアされます。
doneで実行。
空エンターはエラーになってます。
$ mark * 12 files marked. $ Invalid command "". Enter "done" to exit. $ ls *bacula-dir.conf *bacula-dir.conf.org *bacula-fd.conf *bacula-fd.conf.org *bacula-sd.conf *bacula-sd.conf.org *bconsole.conf *bconsole.conf.org *config/ *query.sql $ Invalid command "". Enter "done" to exit. $ Invalid command "". Enter "done" to exit. $ done
いろいろ出て完了。
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-0019 File1 FileChgr1 Volumes marked with "*" are in the Autochanger. 14 files 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-fd Restore Client: bacula-fd Storage: File1 When: 2018-06-05 20:09:15 Catalog: MyCatalog Priority: 10 Plugin Options: *None* OK to run? (yes/mod/no): yes Job queued. JobId=33 *
デフォルトは/tmp/bacula-restores配下にリストアされるようです。
[root@bacula bacula]# ls -l /tmp/bacula-restores/etc/bacula/ 合計 68 -rw-r-----. 1 root root 9165 6月 5 18:42 bacula-dir.conf -rw-r-----. 1 bacula bacula 9186 5月 19 19:29 bacula-dir.conf.org -rw-r-----. 1 bacula bacula 1048 6月 5 18:44 bacula-fd.conf -rw-r-----. 1 bacula bacula 1067 5月 24 19:01 bacula-fd.conf.org -rw-r-----. 1 root root 9795 6月 5 19:59 bacula-sd.conf -rw-r-----. 1 bacula bacula 9814 5月 24 19:06 bacula-sd.conf.org -rw-r-----. 1 bacula bacula 239 5月 24 19:09 bconsole.conf -rw-r-----. 1 bacula bacula 249 5月 24 19:09 bconsole.conf.org drwxr-xr-x. 2 root root 51 6月 5 18:39 config -rw-r-----. 1 bacula bacula 312 1月 29 21:38 query.sql [root@bacula bacula]#
元のディレクトリ見ると同じ状態になってますね。
ファイルのリストアができました!
[root@bacula bacula]# ls -l /etc/bacula/ 合計 68 -rw-r-----. 1 root root 9165 6月 5 18:42 bacula-dir.conf -rw-r-----. 1 bacula bacula 9186 5月 19 19:29 bacula-dir.conf.org -rw-r-----. 1 bacula bacula 1048 6月 5 18:44 bacula-fd.conf -rw-r-----. 1 bacula bacula 1067 5月 24 19:01 bacula-fd.conf.org -rw-r-----. 1 root root 9795 6月 5 19:59 bacula-sd.conf -rw-r-----. 1 bacula bacula 9814 5月 24 19:06 bacula-sd.conf.org -rw-r-----. 1 bacula bacula 239 5月 24 19:09 bconsole.conf -rw-r-----. 1 bacula bacula 249 5月 24 19:09 bconsole.conf.org drwxr-xr-x. 2 root root 51 6月 5 18:39 config -rw-r-----. 1 bacula bacula 312 1月 29 21:38 query.sql [root@bacula bacula]#
バックアップはルートディレクトリから取ってるのでリストア先をルートにすればOSごとリストア出来るんですかね?
余裕があればやってみます。
バックアップの残作業
とりあえずバックアップを取れればよいのでConfigの精査は後回しにします。
次はubuntuのバックアップをやってみます。