Files
calypso/docs/alpha/components/bacula/BACULA-CONFIGURATION.md
2026-01-04 19:42:58 +07:00

444 lines
6.8 KiB
Markdown

# Bacula Configuration Guide
## For Calypso Backup Appliance
**Version:** 1.0
**Target OS:** Ubuntu Server 24.04 LTS
---
## 1. Overview
This guide covers advanced configuration of Bacula for integration with Calypso backup appliance, including storage pools, schedules, clients, and job definitions.
---
## 2. Configuration Files
### 2.1 Main Configuration Files
- **Director:** `/opt/bacula/etc/bacula-dir.conf`
- **Storage Daemon:** `/opt/bacula/etc/bacula-sd.conf`
- **File Daemon:** `/opt/bacula/etc/bacula-fd.conf`
- **Console:** `/opt/bacula/etc/bconsole.conf`
### 2.2 Configuration File Structure
Each configuration file contains:
- **Resource definitions** (Director, Storage, Client, etc.)
- **Directives** (settings and options)
- **Comments** (documentation)
---
## 3. Director Configuration
### 3.1 Director Resource
```conf
Director {
Name = bacula-dir
DIRport = 9101
QueryFile = "/opt/bacula/scripts/query.sql"
WorkingDirectory = "/opt/bacula/working"
PidDirectory = "/opt/bacula/working"
Maximum Concurrent Jobs = 10
Password = "director-password"
Messages = Daemon
}
```
### 3.2 Catalog Resource
```conf
Catalog {
Name = MyCatalog
dbname = "bacula"
dbuser = "bacula"
dbpassword = "bacula-db-password"
dbaddress = "localhost"
dbport = 5432
}
```
### 3.3 Storage Resource
```conf
Storage {
Name = FileStorage
Address = localhost
SDPort = 9103
Password = "storage-password"
Device = FileStorage
Media Type = File
}
```
### 3.4 Pool Resource
```conf
Pool {
Name = DefaultPool
Pool Type = Backup
Recycle = yes
AutoPrune = yes
Volume Retention = 365 days
Maximum Volume Bytes = 50G
Maximum Volumes = 100
Label Format = "Volume-"
}
```
### 3.5 Schedule Resource
```conf
Schedule {
Name = WeeklyCycle
Run = Full 1st sun at 2:05
Run = Differential 2nd-5th sun at 2:05
Run = Incremental mon-sat at 2:05
}
```
### 3.6 Client Resource
```conf
Client {
Name = client-fd
Address = client.example.com
FDPort = 9102
Catalog = MyCatalog
Password = "client-password"
File Retention = 60 days
Job Retention = 6 months
AutoPrune = yes
}
```
### 3.7 Job Resource
```conf
Job {
Name = "BackupClient"
Type = Backup
Client = client-fd
FileSet = "Full Set"
Schedule = WeeklyCycle
Storage = FileStorage
Pool = DefaultPool
Messages = Standard
Priority = 10
Write Bootstrap = "/opt/bacula/working/BackupClient.bsr"
}
```
### 3.8 FileSet Resource
```conf
FileSet {
Name = "Full Set"
Include {
Options {
signature = MD5
compression = GZIP
}
File = /home
File = /etc
File = /var
}
Exclude {
File = /tmp
File = /proc
File = /sys
File = /.snapshot
}
}
```
---
## 4. Storage Daemon Configuration
### 4.1 Storage Resource
```conf
Storage {
Name = FileStorage
WorkingDirectory = "/opt/bacula/working"
Pid Directory = "/opt/bacula/working"
Maximum Concurrent Jobs = 20
}
```
### 4.2 Director Resource (in SD)
```conf
Director {
Name = bacula-dir
Password = "storage-password"
}
```
### 4.3 Device Resource (Disk)
```conf
Device {
Name = FileStorage
Media Type = File
Archive Device = /srv/calypso/backups
LabelMedia = yes
Random Access = yes
AutomaticMount = yes
RemovableMedia = no
AlwaysOpen = no
Maximum Concurrent Jobs = 5
}
```
### 4.4 Device Resource (Tape)
```conf
Device {
Name = TapeDrive-0
Media Type = LTO-8
Archive Device = /dev/nst0
AutomaticMount = yes
AlwaysOpen = no
RemovableMedia = yes
RandomAccess = no
MaximumFileSize = 10GB
MaximumBlockSize = 524288
AutoChanger = yes
ChangerDevice = /dev/sg0
ChangerCommand = "/opt/bacula/scripts/mtx-changer %c %o %S %a %d"
}
```
---
## 5. File Daemon Configuration
### 5.1 Director Resource (in FD)
```conf
Director {
Name = bacula-dir
Password = "client-password"
}
```
### 5.2 FileDaemon Resource
```conf
FileDaemon {
Name = client-fd
FDport = 9102
WorkingDirectory = /opt/bacula/working
Pid Directory = /opt/bacula/working
Maximum Concurrent Jobs = 2
Plugin Directory = /opt/bacula/plugins
}
```
### 5.3 Messages Resource
```conf
Messages {
Name = Standard
director = bacula-dir = all, !skipped, !restored
}
```
---
## 6. Integration with Calypso Storage
### 6.1 Using Calypso ZFS Datasets
Configure Bacula to use ZFS datasets managed by Calypso:
```conf
Device {
Name = ZFSStorage
Media Type = File
Archive Device = /srv/calypso/backups/zfs-pool
LabelMedia = yes
Random Access = yes
AutomaticMount = yes
}
```
### 6.2 Using Calypso Storage Repositories
```conf
Device {
Name = CalypsoRepo
Media Type = File
Archive Device = /srv/calypso/backups/repository-1
LabelMedia = yes
Random Access = yes
}
```
---
## 7. Advanced Configuration
### 7.1 Compression
Enable compression in FileSet:
```conf
FileSet {
Name = "Compressed Set"
Include {
Options {
compression = GZIP9
signature = MD5
}
File = /data
}
}
```
### 7.2 Deduplication
For ZFS with deduplication, use aligned plugin:
```conf
FileSet {
Name = "Deduplicated Set"
Include {
Options {
plugin = "aligned"
}
File = /data
}
}
```
### 7.3 Encryption
Enable encryption (requires encryption plugin):
```conf
FileSet {
Name = "Encrypted Set"
Include {
Options {
encryption = AES256
}
File = /sensitive-data
}
}
```
---
## 8. Job Scheduling
### 8.1 Daily Incremental
```conf
Schedule {
Name = DailyIncremental
Run = Incremental daily at 02:00
}
```
### 8.2 Weekly Full
```conf
Schedule {
Name = WeeklyFull
Run = Full weekly on Sunday at 02:00
}
```
### 8.3 Monthly Archive
```conf
Schedule {
Name = MonthlyArchive
Run = Full 1st sun at 01:00
Run = Incremental 2nd-4th sun at 01:00
}
```
---
## 9. Testing Configuration
### 9.1 Test Director
```bash
sudo /opt/bacula/bin/bacula-dir -t -u bacula -g bacula
```
### 9.2 Test Storage Daemon
```bash
sudo /opt/bacula/bin/bacula-sd -t -u bacula -g bacula
```
### 9.3 Test File Daemon
```bash
sudo /opt/bacula/bin/bacula-fd -t -u bacula -g bacula
```
### 9.4 Reload Configuration
After testing, reload:
```bash
sudo -u bacula /opt/bacula/bin/bconsole
* reload
* quit
```
Or restart services:
```bash
sudo systemctl restart bacula-dir
sudo systemctl restart bacula-sd
```
---
## 10. Monitoring and Maintenance
### 10.1 Job Status
```bash
sudo -u bacula /opt/bacula/bin/bconsole
* status director
* show jobs
* messages
```
### 10.2 Volume Management
```bash
* list volumes
* label
* delete volume=Volume-001
```
### 10.3 Database Maintenance
```bash
# Vacuum database
sudo -u postgres psql -d bacula -c "VACUUM ANALYZE;"
# Check database size
sudo -u postgres psql -d bacula -c "SELECT pg_size_pretty(pg_database_size('bacula'));"
```
---
## References
- Bacula Main Manual: https://www.bacula.org/documentation/
- Configuration Examples: `/opt/bacula/etc/` (after installation)