CentOS Stream 9
Sponsored Link

Bacula : Add remote Clients2022/07/20

 
It's possible to add remote Hosts as backup target Clients.
This example is based on the environment like follows.
+----------------------+          |          +----------------------+
| [   Bacula Server  ] |10.0.0.30 | 10.0.0.51| [   Bacula Client  ] |
|    Bacula Director   +----------+----------+    (Backup Target)   |
|    Bacula Storage    |                     |  Bacula File Daemon  |
|  Bacula File Daemon  |                     |                      |
|       Maria DB       |                     |                      |
+----------------------+                     +----------------------+

[1]
[2] Install File component on new remote Bacula client Host.
[root@node01 ~]#
dnf -y install bacula-client bacula-console
[3] On Bacula Server, if Firewalld is running, allow service.
[root@dlp ~]#
firewall-cmd --add-service=bacula

success
[root@dlp ~]#
firewall-cmd --runtime-to-permanent

success
[4] On Bacula Client, if Firewalld is running, allow service.
[root@node01 ~]#
firewall-cmd --add-service=bacula-client

success
[root@node01 ~]#
firewall-cmd --runtime-to-permanent

success
[5] Configure Bacula Server.
[root@dlp ~]#
vi /etc/bacula/bacula-dir.conf
# add to the end
# define job
JobDefs {
  Name = "Job-node01"
  Type = Backup
  Level = Incremental
  # specify [Name] value in [Client] section
  Client = node01
  # specify [Name] value in [FileSet] section
  FileSet = "Node01 Set"
  Schedule = "WeeklyCycle"
  Storage = File1
  Messages = Standard
  Pool = File
  SpoolAttributes = yes
  Priority = 10
  Write Bootstrap = "/var/spool/bacula/%c.bsr"
}

# define backup job
Job {
  Name = "node01-BackupClient"
  # specify [Name] value in [Client] section
  Client = node01
  # specify [Name] value in [JobDefs] section
  JobDefs = "Job-node01"
}

# define File Set
FileSet {
  Name = "Node01 Set"
  Include {
    Options {
      signature = MD5
      Compression = GZIP
    }
      # backup target directory
      File = /etc
  }
}

# define client
Client {
  Name = node01
  # client hostname or IP address
  Address = node01.srv.world
  FDPort = 9102
  Catalog = MyCatalog
  # password for File daemon
  Password = "password"
  File Retention = 60 days
  Job Retention = 6 months
  AutoPrune = yes
}

[root@dlp ~]#
systemctl restart bacula-dir

[6] Configure Bacula Client.
[root@node01 ~]#
vi /etc/bacula/bacula-fd.conf
Director {
  Name = bacula-dir
  # line 19 : password for File daemon
  Password = "password"
}

.....
.....

# line 28 : tray-monitor password
Director {
  Name = bacula-mon
  Password = "password"
  Monitor = yes
}

[root@node01 ~]#
vi /etc/bacula/bconsole.conf
Director {
  Name = bacula-dir
  DIRport = 9101
  # hostname or IP address of Director daemon
  address = dlp.srv.world
  # password which is set in Director
  Password = "password"
}

[root@node01 ~]#
systemctl enable --now bacula-fd

[7] That's OK.
It's possible to run backup and restore operation on both Server or Client.
For example, run backup and restore on Client Host.
# backup

[root@node01 ~]#
bconsole

Connecting to Director dlp.srv.world:9101
1000 OK: 10002 bacula-dir Version: 11.0.1 (05 February 2020)
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
Enter autochanger drive[0]:
Enter new Volume name: Vol_node01-etc_20220720
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_20220720" Slot 0 ...
3999 Device "FileChgr1" not found or could not be opened.
Label command failed for Volume Vol_node01-etc_20220720.
Do not forget to mount the drive!!!

*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:     2022-07-20 08:51:37
Priority: 10
OK to run? (yes/mod/no): yes
Job queued. JobId=3
You have messages.
*exit

# restore

[root@node01 ~]#
bconsole

Connecting to Director dlp.srv.world:9101
1000 OK: 10002 bacula-dir Version: 11.0.1 (05 February 2020)
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: Cancel
Select item:  (1-13): 5
Defined Clients:
     1: bacula-fd
     2: node01
Select the Client (1-2): 2
Automatically selected FileSet: Node01 Set
+-------+-------+----------+-----------+---------------------+--------------+
| JobId | Level | JobFiles | JobBytes  | StartTime           | VolumeName   |
+-------+-------+----------+-----------+---------------------+--------------+
|     3 | F     |      875 | 4,019,060 | 2022-07-20 08:51:45 | Vol-20220719 |
+-------+-------+----------+-----------+---------------------+--------------+
You have selected the following JobId: 3

Building directory tree for JobId(s) 3 ...  +++++++++++++++++++++++++++++++++++++++
717 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
875 files marked.
$ 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-20220719              File1                     FileChgr1

Volumes marked with "*" are in the Autochanger.


875 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:   node01
Restore Client:  node01
Storage:         File1
When:            2022-07-20 09:15:01
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=4
*exit

[root@node01 ~]#
ll /tmp/bacula-restores/etc

total 1188
-rw-r--r--.  1 root root       16 Nov 26  2021 adjtime
-rw-r--r--.  1 root root     1529 Jun 23  2020 aliases
drwxr-xr-x.  2 root root     4096 Nov 26  2021 alternatives
-rw-r--r--.  1 root root      541 May 31 23:29 anacrontab
-rw-r--r--.  1 root root        1 Apr  4 19:27 at.deny
drwxr-x---.  4 root root      100 Jul 12 10:25 audit
drwxr-xr-x.  3 root root     4096 Jun  8 13:13 authselect
drwxr-xr-x.  2 root root       49 Jul 20 08:47 bacula
drwxr-xr-x.  2 root root      124 Jul 12 10:25 bash_completion.d
-rw-r--r--.  1 root root     3019 Jun 23  2020 bashrc
-rw-r--r--.  1 root root      535 Aug 10  2021 bindresvport.blacklist
drwxr-xr-x.  2 root root        6 Apr 20 18:30 binfmt.d
-rw-r--r--.  1 root root       24 Mar  3 03:31 centos-release
-rw-r--r--.  1 root root     1393 Mar 15 13:27 chrony.conf
-rw-r-----.  1 root chrony    540 Dec 16  2021 chrony.keys
drwxr-xr-x.  2 root root       26 Jun 13 20:19 cifs-utils
.....
.....
# restored
Matched Content