FreeBSD 14
Sponsored Link

Bacula : リモートクライアントの設定2024/09/19

 

バックアップ対象のクライアントはリモートホストも設定可能です。
例として、以下のような環境でバックアップ対象クライアントを設定します。

+----------------------+          |          +----------------------+
| [   Bacula Server  ] |10.0.0.30 | 10.0.0.51| [   Bacula Client  ] |
|    Bacula Director   +----------+----------+    (Backup Target)   |
|    Bacula Storage    |                     |  Bacula File Daemon  |
|  Bacula File Daemon  |                     |                      |
|      PostgreSQL      |                     |                      |
+----------------------+                     +----------------------+

[1]

こちらを参考に Bacula サーバーの基本的な設定をして起動しておきます

[2] 新規に追加する Bacula クライアントに File コンポーネントをインストールします。
root@node01:~ #
pkg install -y bacula15-server
[3] Bacula サーバーの設定です。
root@dlp:~ #
vi /usr/local/etc/bacula/bacula-dir.conf
# 最終行に追記
# ジョブの定義
JobDefs {
  Name = "Job-node01"
  Type = Backup
  Level = Incremental
  # クライアントの定義の [Name] 値を指定
  Client = node01
  # ファイルセットの定義の [Name] 値を指定
  FileSet = "Node01 Set"
  Schedule = "WeeklyCycle"
  Storage = File1
  Messages = Standard
  Pool = File
  SpoolAttributes = yes
  Priority = 10
  Write Bootstrap = "/var/db/bacula/%c.bsr"
}

# バックアップジョブの定義
Job {
  Name = "node01-BackupClient"
  # クライアントの定義の [Name] 値を指定
  Client = node01
  # ジョブの定義の [Name] 値を指定
  JobDefs = "Job-node01"
}

# ファイルセットの定義
FileSet {
  Name = "Node01 Set"
  Include {
    Options {
      signature = MD5
    }
      # バックアップ対象ディレクトリ
      File = /etc
  }
}

# クライアントの定義
Client {
  Name = node01
  # クライアントのホスト名 または IP アドレス
  Address = node01.srv.world
  FDPort = 9102
  Catalog = MyCatalog
  # File デーモン接続パスワード
  Password = "password"
  File Retention = 60 days
  Job Retention = 6 months
  AutoPrune = yes
}

root@dlp:~ #
service bacula-dir restart

[4] Bacula クライアントの設定です。
root@node01:~ #
vi /usr/local/etc/bacula/bacula-fd.conf
Director {
  # 18行目 : サーバー側と同じ Director 名に変更
  # 19行目 : Director デーモン接続パスワード
  Name = dlp.srv.world-dir
  Password = "password"
}

.....
.....

Director {
  # 27行目 : サーバー側と同じ tray-monitor 名に変更
  # 28行目 : tray-monitor 接続パスワード
  Name = dlp.srv.world-mon
  Password = "password"
  Monitor = yes
}

FileDaemon {                          # this is me
  # 36行目 : File デーモンの名前変更
  # 任意の名称でよいが Director デーモンの名前の箇所は名前を合わせる必要がある
  Name = node01.srv.world-fd
  FDport = 9102                  # where we listen for the director
  WorkingDirectory = /var/db/bacula
  Pid Directory = /var/run
  Maximum Concurrent Jobs = 20
  Plugin Directory = /usr/local/lib

Messages {
  Name = Standard
  # 47行目 : Director 名に変更
  director = dlp.srv.world-dir = all, !skipped, !restored
}

root@node01:~ #
vi /usr/local/etc/bacula/bconsole.conf
Director {
  # Director 名
  Name = dlp.srv.world-dir
  DIRport = 9101
  # Director 稼働ホストのホスト名 または IP アドレス
  address = dlp.srv.world
  # Director デーモン接続パスワード
  Password = "password"
}

root@node01:~ #
service bacula-fd enable

bacula_fd enabled in /etc/rc.conf
root@node01:~ #
service bacula-fd start

Starting bacula_fd.
[5] 以上で設定完了です。
バックアップ/リストア操作は、サーバー/クライアント どこからでも実行可能です。
例として、クライアント上でバックアップ/リストアを実行します。
# バックアップ

root@node01:~ #
bconsole

Connecting to Director dlp.srv.world:9101
1000 OK: 10002 dlp.srv.world-dir Version: 15.0.2 (21 March 2024)
Enter a period to cancel a command.
*label
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
The defined Storage resources are:
     1: File1
     2: File2
Select Storage resource (1-2): 1
Connecting to Storage daemon File1 at dlp.srv.world:9103 ...
Enter autochanger drive[0]:
Enter new Volume name: Vol_node01-etc_20240919-2
Enter slot (0 or Enter for none):
Defined Pools:
     1: Default
     2: File
     3: Scratch
Select the Pool (1-3): 2
Connecting to Storage daemon File1 at dlp.srv.world:9103 ...
Sending label command for Volume "Vol_node01-etc_20240919-2" Slot 0 ...
3000 OK label. VolBytes=265 VolABytes=0 VolType=1 UseProtect=0 VolEncrypted=0 Volume="Vol_node01-etc_20240919-2" Device="FileChgr1-Dev1" (/tmp)
Catalog record for Volume "Vol_node01-etc_20240919-2", Slot 0  successfully created.
Requesting to mount FileChgr1 ...
3906 File device ""FileChgr1-Dev1" (/tmp)" is always mounted.

*run
A job name must be specified.
The defined Job resources are:
     1: BackupClient1
     2: BackupCatalog
     3: RestoreFiles
     4: node01-BackupClient
Select Job resource (1-4): 4
Run Backup job
JobName:  node01-BackupClient
Level:    Incremental
Client:   node01
FileSet:  Node01 Set
Pool:     File (From Job resource)
Storage:  File1 (From Job resource)
When:     2024-09-19 13:10:44
Priority: 10
OK to run? (yes/mod/no): yes
Job queued. JobId=7
You have messages.
*exit

# リストア

root@node01:~ #
bconsole

Connecting to Director dlp.srv.world:9101
1000 OK: 10002 dlp.srv.world-dir Version: 15.0.2 (21 March 2024)
Enter a period to cancel a command.
*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: Select object to restore
    14: Cancel
Select item:  (1-14): 5
Defined Clients:
     1: dlp.srv.world-fd
     2: node01
Select the Client (1-2): 2
Automatically selected FileSet: Full Set
Automatically selected FileSet: Node01 Set
+-------+-------+----------+-----------+---------------------+---------------------------+
| jobid | level | jobfiles | jobbytes  | starttime           | volumename                |
+-------+-------+----------+-----------+---------------------+---------------------------+
|     7 | F     |      642 | 1,898,933 | 2024-09-19 13:11:18 | Vol_node01-etc_20240919-2 |
+-------+-------+----------+-----------+---------------------+---------------------------+
You have selected the following JobId: 7

Building directory tree for JobId(s) 7 ...  +++++++++++++++++++++++++++++++++++++++++++++++
612 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
etc/
$ mark etc
642 files marked.
$ done
Bootstrap records written to /var/db/bacula/dlp.srv.world-dir.restore.2.bsr

The Job will require the following (*=>InChanger):
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================

    Vol_node01-etc_20240919-2 File1                     FileChgr1

Volumes marked with "*" are in the Autochanger.


642 files selected to be restored.

Using Catalog "MyCatalog"
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/db/bacula/dlp.srv.world-dir.restore.2.bsr
Where:           /tmp/bacula-restores
Replace:         Always
FileSet:         Full Set
Backup Client:   dlp.srv.world-fd
Restore Client:  node01
Storage:         File1
When:            2024-09-19 13:20:39
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=8
*exit

root@node01:~ #
ls -l /tmp/bacula-restores/etc

total 499
drwxr-xr-x  2 root wheel        2 Nov 10  2023 X11
lrwxr-xr-x  1 root wheel       12 Nov 10  2023 aliases -> mail/aliases
drwxr-xr-x  2 root wheel        2 Nov 10  2023 authpf
-rw-r--r--  1 root wheel      285 Nov 10  2023 auto_master
drwxr-xr-x  2 root wheel        9 Nov 10  2023 autofs
-rw-r--r--  1 root wheel      379 Nov 10  2023 blacklistd.conf
drwxr-xr-x  2 root wheel        5 Nov 10  2023 bluetooth
drwxr-xr-x  2 root wheel        3 Nov 10  2023 cron.d
-rw-r--r--  1 root wheel      646 Nov 10  2023 crontab
-rw-r--r--  1 root wheel       40 Nov 10  2023 csh.cshrc
-rw-r--r--  1 root wheel      288 Nov 10  2023 csh.login
-rw-r--r--  1 root wheel       41 Nov 10  2023 csh.logout
-rw-r--r--  1 root wheel      494 Nov 10  2023 ddb.conf
drwxr-xr-x  2 root wheel        6 Jul 18 09:42 defaults
.....
.....
# リストアされた
関連コンテンツ