[Linux][Backup] Bacula3.0.1-1(設定項目について考える)

技術のお話し

さー、インストールも終わったしバックアップだーと言いたいところだが、その前に、Baculaを自分なりに理解した結果を記載してみる。

bacula-ppt-101

Baculaには大まかに3つのサービスがあり、それぞれ上表の役割を担っている。というわけで、ジョブの定義だったり、ストレージの定義だったり、バックアップ選択の設定はこれら上表の真ん中、「設定ファイル」列にて示しているファイルにて定義を記載することにより行うことになる。

また、面白いなと思ったのはこれらサービス間で独自の認証体系を持っている点にある。

bacula-ppt-102

(誤植:すみません。Bacula File Daemonと2か所書いちゃってますね。正しくは右側は「Storage Daemon」でございます・・・・)

各サービスに紐つく設定ファイル内にてパスワードが平文で定義されるようになっていて、これは常に固定である。そうしてあらかじめ定義したパスワードを勘合させることにより、各サービスが連携して動作するという仕組みになっている。つまりは、

  • bconsoleはbconsole設定ファイル内のパスワードを使用してBacula Directorへアクセスを試みる
  • Bacula Directorはbconsoleからの認証要求を受け付ける
  • Bacula Directorは設定ファイル内のパスワードを使用してBacula File Daemonへアクセスを試みる
  • Bacula Directorは設定ファイル内のパスワードを使用してBacula Storage Daemonへアクセスを試みる
  • Bacula File DaemonはBacula Directorからの認証要求を受け付ける
  • Bacula Storage DaemonはBacula Directorからの認証要求を受け付ける

と言うことだと思う。多分。

それでは、各設定を見てみようと思う。実際に出力したファイルがベースになるが、明らかに冗長なところは削除してみた。

[root@demeter bacula]# cat /etc/bacula/bacula-dir.conf
Director {                            # define myself
Name = demeter-dir
DIRport = 9101                # where we listen for UA connections
QueryFile = “/usr/lib/bacula/query.sql”
WorkingDirectory = “/var/lib/bacula”
PidDirectory = “/var/run”
Maximum Concurrent Jobs = 1
Password = “Q4YJl5yXxPXtPaJzeGT69Enb1QAwg0nN7imEBqUnZb2a”         # Console password
Messages = Daemon
}

JobDefs {
Name = “DefaultJob”
Type = Backup
Level = Incremental
Client = demeter-fd
FileSet = “Full Set”
Schedule = “WeeklyCycle”
Storage = File
Messages = Standard
Pool = Default
Priority = 10
}

#
# Define the main nightly save backup job
#   By default, this job will back up to disk in
Job {
Name = “Client1”
JobDefs = “DefaultJob”
Write Bootstrap = “/var/lib/bacula/Client1.bsr”
}

# Backup the catalog database (after the nightly save)
Job {
Name = “BackupCatalog”
JobDefs = “DefaultJob”
Level = Full
FileSet=”Catalog”
Schedule = “WeeklyCycleAfterBackup”
RunBeforeJob = “/usr/lib/bacula/make_catalog_backup bacula bacula”
RunAfterJob  = “/usr/lib/bacula/delete_catalog_backup”
Write Bootstrap = “/var/lib/bacula/BackupCatalog.bsr”
Priority = 11                   # run after main backup
}

#
# Standard Restore template, to be changed by Console program
#  Only one such job is needed for all Jobs/Clients/Storage …
#
Job {
Name = “RestoreFiles”
Type = Restore
Client=demeter-fd
FileSet=”Full Set”
Storage = File
Pool = Default
Messages = Standard
Where = /bacula-restores
}

# List of files to be backed up
FileSet {
Name = “Full Set”
Include {
Options {
signature = MD5
}
File = /usr/src/redhat/BUILD/bacula-3.0.1
}

Exclude {
File = /proc
File = /tmp
File = /.journal
File = /.fsck
}
}

Schedule {
Name = “WeeklyCycle”
Run = Full 1st sun at 23:05
Run = Differential 2nd-5th sun at 23:05
Run = Incremental mon-sat at 23:05
}

Schedule {
Name = “WeeklyCycleAfterBackup”
Run = Full sun-sat at 23:10
}

# This is the backup of the catalog
FileSet {
Name = “Catalog”
Include {
Options {
signature = MD5
}
File = /var/lib/bacula/bacula.sql
}
}

# Client (File Services) to backup
Client {
Name = demeter-fd
Address = demeter
FDPort = 9102
Catalog = MyCatalog
Password = “Q4YJl5yXxPXtPaJzeGT69Enb1QAwg0nN7imEBqUnZb2a”
File Retention = 30 days            # 30 days
Job Retention = 6 months            # six months
AutoPrune = yes                     # Prune expired Jobs/Files
}

# Definition of file storage device
Storage {
Name = File
# Do not use “localhost” here
Address = demeter                # N.B. Use a fully qualified name here
SDPort = 9103
Password = “Q4YJl5yXxPXtPaJzeGT69Enb1QAwg0nN7imEBqUnZb2a”
Device = FileStorage
Media Type = File
}

# Generic catalog service
Catalog {
Name = MyCatalog
# Uncomment the following line if you want the dbi driver
# dbdriver = “dbi:mysql”; dbaddress = 127.0.0.1; dbport =
dbname = “bacula”; dbuser = “bacula”; dbpassword = “”
}

# Reasonable message delivery — send most everything to email address
#  and to the console
Messages {
Name = Standard
mailcommand = “/usr/sbin/bsmtp -h localhost -f \”\(Bacula\) \<%r\>\” -s \”Bacula: %t %e of %c %l\” %r”
operatorcommand = “/usr/sbin/bsmtp -h localhost -f \”\(Bacula\) \<%r\>\” -s \”Bacula: Intervention needed for %j\” %r”
mail = root@localhost = all, !skipped
operator = root@localhost = mount
console = all, !skipped, !saved
append = “/var/lib/bacula/log” = all, !skipped
}

#
# Message delivery for daemon messages (no job).
Messages {
Name = Daemon
mailcommand = “/usr/sbin/bsmtp -h localhost -f \”\(Bacula\) \<%r\>\” -s \”Bacula daemon message\” %r”
mail = root@localhost = all, !skipped
console = all, !skipped, !saved
append = “/var/lib/bacula/log” = all, !skipped
}

# Default pool definition
Pool {
Name = Default
Pool Type = Backup
Recycle = yes                       # Bacula can automatically recycle Volumes
AutoPrune = yes                     # Prune expired volumes
Volume Retention = 365 days         # one year
}

# Scratch pool definition
Pool {
Name = Scratch
Pool Type = Backup
}

[root@demeter bacula]#

続いてFileDaemonの設定ファイル。

Director {
Name = demeter-dir
Password = “Q4YJl5yXxPXtPaJzeGT69Enb1QAwg0nN7imEBqUnZb2a”
}

FileDaemon {                          # this is me
Name = demeter-fd
FDport = 9102                  # where we listen for the director
WorkingDirectory = /var/lib/bacula
Pid Directory = /var/run
Maximum Concurrent Jobs = 20
}

# Send all messages except skipped files back to Director
Messages {
Name = Standard
director = demeter-dir = all, !skipped, !restored
}
[root@demeter bacula]#

最後にStorage Daemonの設定ファイル

[root@demeter bacula]# cat bacula-sd.conf
Storage {                             # definition of myself
Name = demeter-sd
SDPort = 9103                  # Director’s port
WorkingDirectory = “/var/lib/bacula”
Pid Directory = “/var/run”
Maximum Concurrent Jobs = 20
}

Director {
Name = demeter-dir
Password = “Q4YJl5yXxPXtPaJzeGT69Enb1QAwg0nN7imEBqUnZb2a”
}

Device {
Name = FileStorage
Media Type = File
Archive Device =/var/backup
LabelMedia = yes;                   # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes;               # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
}

#
# An autochanger device with two drives
#
#Autochanger {
#  Name = Autochanger
#  Device = Drive-1
#  Device = Drive-2
#  Changer Command = “/usr/lib/bacula/mtx-changer %c %o %S %a %d”
#  Changer Device = /dev/sg0
#}

#Device {
#  Name = Drive-1                      #
#  Drive Index = 0
#  Media Type = DLT-8000
#  Archive Device = /dev/nst0
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  AutoChanger = yes
#  #
#  Alert Command = “sh -c ‘tapeinfo -f %c |grep TapeAlert|cat'”
#  If you have smartctl, enable this, it has more info than tapeinfo
#  Alert Command = “sh -c ‘smartctl -H -l error %c'”
#}

#Device {
#  Name = Drive-2                      #
#  Drive Index = 1
#  Media Type = DLT-8000
#  Archive Device = /dev/nst1
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  AutoChanger = yes
#  # Enable the Alert command only if you have the mtx package loaded
#  Alert Command = “sh -c ‘tapeinfo -f %c |grep TapeAlert|cat'”
#  If you have smartctl, enable this, it has more info than tapeinfo
#  Alert Command = “sh -c ‘smartctl -H -l error %c'”
#}

#
# A Linux or Solaris tape drive
#
#Device {
#  Name = DDS-4                        #
#  Media Type = DDS-4
#  Archive Device = /dev/nst0
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
## Changer Command = “/usr/lib/bacula/mtx-changer %c %o %S %a %d”
## Changer Device = /dev/sg0
## AutoChanger = yes
#  # Enable the Alert command only if you have the mtx package loaded
## Alert Command = “sh -c ‘tapeinfo -f %c |grep TapeAlert|cat'”
#}

#
# Send all messages to the Director,
# mount messages also are sent to the email address
#
Messages {
Name = Standard
director = demeter-dir = all
}
[root@demeter bacula]#

ひとまず、簡単な概要としては、bacula-dir.confを押さえるべきだろうということで、ここに挙げられる構成要素について考えてみた。その結果が下表のとおりとなる。

bacula-ppt-103

そして、それぞれの構成要素の相関は以下の通り示されると考えられる。

bacula-ppt-104

なるほど、恐らくはほぼすべてのバックアップに関する定義がこのファイルにすべて収められることになる。

ふと気付いたのが、Backup Execだとジョブ自体に「追記」「上書き」の指定を行うのだけど、これがどこにもない。調べてみたら以下素敵なURLを見つけた。

http://lunatear.net/archives/001072.html

Maximum Volume Jobs = 1

これでそのボリュームに対する最大の追記世代数が記載できるようだ。同じくしてメディアラベルの接頭辞をキーにプールわけが行える所は、ほとんどNBUと変わらないと言ってもいいのだろう。なるほど納得。

ちょっとディスク容量が少ない事と、物理テープデバイスを使ってるサーバだとOSの居れ直しから頑張らなきゃならない事、バックアップ構成組むにはまだまだ課題が山積していることから、まだまだこの評価環境だけでのお勉強が必要だなーと痛感した次第で。今回は概念までってことで。

Tags:

No responses yet

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください

PAGE TOP