Ubuntu 24.04
Sponsored Link

Bacula : दूरस्थ क्लाइंट जोड़ें2024/08/01

 

दूरस्थ होस्ट को बैकअप लक्ष्य क्लाइंट के रूप में जोड़ना संभव है।
यह उदाहरण निम्न प्रकार के वातावरण पर आधारित है।

+----------------------+          |          +----------------------+
| [   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 क्लाइंट होस्ट पर फ़ाइल घटक स्थापित करें।
root@node01:~#
apt -y install bacula-fd bacula-client bacula-console
[3] Bacula सर्वर कॉन्फ़िगर करें।
root@dlp:~#
vi /etc/bacula/bacula-dir.conf
# अंतिम पंक्ति में जोड़ें
# नौकरी परिभाषित करें
JobDefs {
  Name = "Job-node01"
  Type = Backup
  Level = Incremental
  # [क्लाइंट] अनुभाग में [नाम] मान निर्दिष्ट करें
  Client = node01
  # [फ़ाइलसेट] अनुभाग में [नाम] मान निर्दिष्ट करें
  FileSet = "Node01 Set"
  Schedule = "WeeklyCycle"
  Storage = File1
  Messages = Standard
  Pool = File
  SpoolAttributes = yes
  Priority = 10
  Write Bootstrap = "/var/lib/bacula/%c.bsr"
}

# बैकअप कार्य परिभाषित करें
Job {
  Name = "node01-BackupClient"
  # [क्लाइंट] अनुभाग में [नाम] मान निर्दिष्ट करें
  Client = node01
  # [JobDefs] अनुभाग का [Name] मान निर्दिष्ट करें
  JobDefs = "Job-node01"
}

# फ़ाइल सेट परिभाषित करें
FileSet {
  Name = "Node01 Set"
  Include {
    Options {
      signature = MD5
    }
      # बैकअप लक्ष्य निर्देशिका
      File = /etc
  }
}

# ग्राहक को परिभाषित करें
Client {
  Name = node01
  # क्लाइंट होस्टनाम या आईपी पता
  Address = node01.srv.world
  FDPort = 9102
  Catalog = MyCatalog
  # फ़ाइल डेमॉन के लिए पासवर्ड
  Password = "password"
  File Retention = 60 days
  Job Retention = 6 months
  AutoPrune = yes
}

root@dlp:~#
systemctl restart bacula-dir

[4] Bacula क्लाइंट कॉन्फ़िगर करें।
root@node01:~#
vi /etc/bacula/bacula-fd.conf
Director {
  # पंक्ति 16 : निदेशक का नाम बदलें
  # पंक्ति 17 : फ़ाइल डेमॉन के लिए पासवर्ड
  Name = dlp.srv.world-dir
  Password = "password"
}

.....
.....

Director {
  # पंक्ति 25 : निदेशक का नाम बदलें
  # पंक्ति 26 : फ़ाइल डेमॉन के लिए पासवर्ड
  Name = dlp.srv.world-mon
  Password = "password"
  Monitor = yes
}

FileDaemon {                          # this is me
  Name = node01.srv.world-fd
  FDport = 9102                  # where we listen for the director
  WorkingDirectory = /var/lib/bacula
  Pid Directory = /run/bacula
  Maximum Concurrent Jobs = 20
  Plugin Directory = /usr/lib/bacula
  # पंक्ति 40 : सुनने का पता
  FDAddress = 0.0.0.0

Messages {
  Name = Standard
  # पंक्ति 46 : निदेशक का नाम बदलें
  director = dlp.srv.world-dir = all, !skipped, !restored
}

root@node01:~#
vi /etc/bacula/bconsole.conf
Director {
  # निर्देशक का नाम
  Name = dlp.srv.world-dir
  DIRport = 9101
  # डायरेक्टर डेमॉन का होस्टनाम या आईपी पता
  address = dlp.srv.world
  # पासवर्ड जो डायरेक्टर में सेट किया गया है
  Password = "password"
}

root@node01:~#
systemctl restart bacula-fd

[5] ठीक है।
सर्वर या क्लाइंट दोनों पर बैकअप और रीस्टोर ऑपरेशन चलाना संभव है।
उदाहरण के लिए, क्लाइंट होस्ट पर बैकअप और रीस्टोर चलाएँ।
# बैकअप

root@node01:~#
bconsole

Connecting to Director dlp.srv.world:9101
1000 OK: 10002 dlp.srv.world-dir Version: 13.0.4 (12 February 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_20240801
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_20240801" Slot 0 ...
3000 OK label. VolBytes=246 VolABytes=0 VolType=1 Volume="Vol_node01-etc_20240801" Device="FileChgr1-Dev1" (/tmp)
Catalog record for Volume "Vol_node01-etc_20240801", 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-08-01 00:22:00
Priority: 10
OK to run? (yes/mod/no): yes
Job queued. JobId=3
You have messages.
*exit

# पुनर्स्थापित करना

root@node01:~#
bconsole

Connecting to Director dlp.srv.world:9101
1000 OK: 10002 dlp.srv.world-dir Version: 13.0.4 (12 February 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: Node01 Set
+-------+-------+----------+-----------+---------------------+-------------------------+
| jobid | level | jobfiles | jobbytes  | starttime           | volumename              |
+-------+-------+----------+-----------+---------------------+-------------------------+
|     3 | F     |    1,727 | 2,308,718 | 2024-08-01 00:22:31 | Vol_node01-etc_20240801 |
+-------+-------+----------+-----------+---------------------+-------------------------+
You have selected the following JobId: 3

Building directory tree for JobId(s) 3 ...  +++++++++++++++++++++++++++++++++++++++++++
1,538 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
1,727 files marked.
$ done
Bootstrap records written to /var/lib/bacula/dlp.srv.world-dir.restore.1.bsr

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

    Vol_node01-etc_20240801   File1                     FileChgr1

Volumes marked with "*" are in the Autochanger.


1,727 files selected to be restored.

Using Catalog "MyCatalog"
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/lib/bacula/dlp.srv.world-dir.restore.1.bsr
Where:           /tmp
Replace:         Always
FileSet:         Full Set
Backup Client:   node01
Restore Client:  node01
Storage:         File1
When:            2024-08-01 00:25:15
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=4
*exit

root@node01:~#
ll /tmp/etc

total 932
drwxr-xr-x 109 root root       4096 Aug  1 00:14 ./
drwxrwxrwt  13 root root       4096 Aug  1 00:26 ../
-rw-------   1 root root          0 Apr 23 09:37 .pwd.lock
-rw-r--r--   1 root root        648 Apr 23 09:40 .resolv.conf.systemd-resolved.bak
-rw-r--r--   1 root root        208 Apr 23 09:37 .updated
drwxr-xr-x   4 root root       4096 Apr 23 09:45 ModemManager/
drwxr-xr-x   2 root root       4096 Apr 23 09:40 PackageKit/
drwxr-xr-x   2 root root       4096 Apr 26 01:07 UPower/
drwxr-xr-x   4 root root       4096 Apr 23 09:40 X11/
-rw-r--r--   1 root root       3444 Jul  5  2023 adduser.conf
drwxr-xr-x   2 root root       4096 Apr 23 09:45 alternatives/
.....
.....
# पुनः स्थापित किए गए
मिलान सामग्री