ログイン
ユーザ名:

パスワード:


パスワード紛失

新規登録
メインメニュー
検索
オンライン状況
33 人のユーザが現在オンラインです。 (1 人のユーザが ニュース を参照しています。)

登録ユーザ: 0
ゲスト: 33

もっと...
Baclua(バックアップ)に挑戦 : 3:bacula-dirの設定
投稿者: f-otake 投稿日時: 2013-12-2 12:06:21 (2515 ヒット)

まずは/etc/bacula/bacula-dir.confの設定(かなり長いですが)。http://lunatear.net/archives/001067.html も参考にしました

Director {                      # define myself
  Name = bacula-dir
  DIRport = 9101                # where we listen for UA connections
  QueryFile = "/usr/libexec/bacula/query.sql" ← こんなファイルは存在しないが、問題無い見たい
  WorkingDirectory = "/var/spool/bacula"
  PidDirectory = "/var/run"
  Maximum Concurrent Jobs = 1
  Password = "xxxxxx" ← database baculaに設定したパスワード
  Messages = Daemon
}

# Define the main nightly save backup job
#   By default, this job will back up to disk in /tmp
Job {
  Name = "Backup-samba" ← 私は二つのホストをバックアップするのでホスト毎に設定
  Client = samba-fd ← 私は二つのホストをバックアップするのでホスト毎に設定
  FileSet = "Full samba" ← 私は二つのホストをバックアップするのでホスト毎に設定
  JobDefs = "DefaultJob" ← このJobの定義はDefaultJobに定義してある
}

Job {
  Name = "Backup-web" ← 私は二つのホストをバックアップするのでホスト毎に設定
  Client = web-fd ← 私は二つのホストをバックアップするのでホスト毎に設定
  FileSet = "Full web" ← 私は二つのホストをバックアップするのでホスト毎に設定
  JobDefs = "DefaultJob" ← samba-fdと同じJobDefsを使う。つまり共通する部分をまとめてDefaultJobとして定義する
}

JobDefs {
  Name = "DefaultJob" ← 上の二つの定義をする
  Type = Backup ← バックアップをする
  Level = Incremental ← 増分の指定
  Schedule = "WeeklyCycle" ← スケジュールはWeeklyCycleを使う
  Storage = File ← ストレージのタイプはFileである。つまりディスクにファイルとして保存する
  Messages = Standard ← e-mailの内容はStandardに定義する
  Pool = File ← Poolはfile
  Priority = 10 ← プライオリティは数が少ないほど高い
  Write Bootstrap = "/var/spool/bacula/%c.bsr" ← Bootstrupファイルを記録するパス。下記参照
}

# Backup the catalog database (after the nightly save)
Job {
  Name = "Catalog-samba" ←名前の定義
  Client = samba-fd ←clientはsamba-fdを使う
  JobDefs = "CatalogJob" ←jobの定義はCatalogJobに書く
}

JobDefs {
  Name = "CatalogJob"
  Type = Backup ← バックアップをする
  Level = Full ← いつもfullバックアップをとる
  FileSet= "Catalog" ← FileSetとして、Catalogに定義する
  Schedule = "WeeklyCycleAfterBackup" ← スケジュールはWeeklyCycleAfterBackupを使う
  Storage = File ← ストレージのタイプはFileである。つまりディスクにファイルとして保存する
  Messages = Standard ← messageはStandardを使う
  Pool = File
  # This creates an ASCII copy of the catalog
  # Arguments to make_catalog_backup.pl are:
  #  make_catalog_backup.pl <catalog-name>
  RunBeforeJob = "/usr/libexec/bacula/make_catalog_backup.pl MyCatalog"
  # This deletes the copy of the catalog
#  RunAfterJob  = "/usr/libexec/bacula/delete_catalog_backup"
  Write Bootstrap = "/var/spool/bacula/%n.bsr" ← 下記参照
  Priority = 11
}

# Standard Restore template, to be changed by Console program
#  Only one such job is needed for all Jobs/Clients/Storage ...
#
Job {
  Name = "Restore-samba" ← 私は二つのホストをバックアップするのでホスト毎に設定
  Type = Restore ← リストアを定義している
  Client= samba-fd ← 私は二つのホストをバックアップするのでホスト毎に設定
  FileSet= "Full samba"                  
  Storage = File
  Pool = Default
  Messages = Standard
  Where = /Backup/Restores/samba ← リストアされるファイルの場所を指定
}

Job {
  Name = "Restore-web"
  Type = Restore
  Client= web-fd
  FileSet= "Full web"                  
  Storage = File
  Pool = Default
  Messages = Standard
  Where = /Backup/Restores/web ← リストアされるファイルの場所を指定
}

# List of files to be backed up
FileSet {
  Name = "Full samba" ← バックアップされるFileSetの名前
  Include {
    Options {
      signature = MD5
      Compression = GZIP ← GZip圧縮を使ってバックアップする
    }
    File = /
    File = /Data ← パーティションが違うので指定
    File = /Download ← パーティションが違うので指定
  }
  Exclude { ← バックアップしたくないディレクトリーをこれ以下に入れる
    File = /Backup ← パーティションが違うので指定しなくてもよいが念の為
    File = /var/spool/bacula ← defaultでbaculaが使うディレクトリ、私は変更しているので指定しなくてもよい
    File = /tmp ← 除外するディレクトリーの指定、最後に / を付けてはいけない
    File = /proc
    File = .journal ← 除外ファイルの指定、*.journal* と言う意味らしい
    File = .fsck
    File = .lock
  }
}

FileSet {
  Name = "Full web"
  Include {
    Options {
      signature = MD5
      Compression = GZIP
    }
    File = /
    File = /Maildata ← パーティションが違うので指定
    File = /webdata ← パーティションが違うので指定
    File = /Davdata ← パーティションが違うので指定
  }
  Exclude {
    File = /var/spool/bacula
    File = /tmp
    File = /proc
    File = .journal
    File = .fsck
    File = .lock
  }
}

# This is the backup of the catalog
FileSet {
  Name = "Catalog"
  Include {
    Options {
      signature = MD5
    }
    File = "/var/spool/bacula/bacula.sql" ← こんなファイルは無いが問題無いみたい
  }
}

# When to do the backups, full backup on first sunday of the month,
#  differential (i.e. incremental since full) every other sunday,
#  and incremental backups other days
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
}

# This schedule does the catalog. It starts after the WeeklyCycle
Schedule { ← この指定はカタログの分、
  Name = "WeeklyCycleAfterBackup"
  Run = Full sun-sat at 2:10
 # 2:10にバックアップするが、このスケジュールを使うCatalogJobの定義にPriority = 11があるので、
 # 各ホストのバックアップが終わってから始まる
}

# Client (File Services) to backup
Client {
  Name = samba-fd
  Address = 192.168.xxx.xxx ← このサーバー自体の設定なので自分のIPを指定
  FDPort = 9102
  Catalog = MyCatalog
  Password = "xxxxxx"              # password for FileDaemon
  File Retention = 62 days         # カタログDBからバックアップしたファイル一覧が削除されるまでの期間
  Job Retention = 3 months         # カタログDBからジョブの記録が消えるまでの期間
  AutoPrune = yes                  # Prune expired Jobs/Files
}

Client {
  Name = web-fd
  Address = 192.168.xxx.xxx ← バックされるもう一つのホストのIP
  FDPort = 9102
  Catalog = MyCatalog
  Password = "xxxxxx"              # password for FileDaemon
  File Retention = 62 days         # カタログDBからバックアップしたファイル一覧が削除されるまでの期間
  Job Retention = 3 months         # カタログDBからジョブの記録が消えるまでの期間
  AutoPrune = yes                  # Prune expired Jobs/Files
}

# Definition of file storage device
Storage {
  Name = File
# Do not use "localhost" here    
  Address = 192.168.xxx.xxx ← ストレージのホストつまり自分のIP、必ずIPで指定
  SDPort = 9103
  Password = "xxxxxx"
  Device = FileStorage
  Media Type = File
}

# Definition of DVD storage device
#Storage {
#  Name = "DVD"
#  Do not use "localhost" here
#  Address = storage.example.com     # N.B. Use a fully qualified name here
#  SDPort = 9103
#  Password = "@@SD_PASSWORD@@"
#  Device = "DVD Writer"
#  MediaType = "DVD"
#}

# Generic catalog service
Catalog {
  Name = MyCatalog
  dbname = "bacula"; dbuser = "bacula"; dbpassword = "xxxxx"
}

# Reasonable message delivery -- send most everything to email address
#  and to the console
Messages {
  Name = Standard
# NOTE! If you send to two email or more email addresses, you will need
#  to replace the %r in the from field (-f part) with a single valid
#  email address in both the mailcommand and the operatorcommand.
#  What this does is, it sets the email address that emails would display
#  in the FROM field, which is by default the same email as they're being
#  sent to.  However, if you send email to more than one address, then
#  you'll have to set the FROM address manually, to a single address. 
#  for example, a 'no-reply@mydomain.com', is better since that tends to
#  tell (most) people that its coming from an automated source.
  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 = xxxxx@asahi.email.ne.jp = all, !skipped ← メールを送るメアドの指定
  operator = xxxxx@asahi.email.ne.jp = mount ← メールを送るメアドの指定
  console = all, !skipped, !saved
# WARNING! the following will create a file that you must cycle from
#          time to time as it will grow indefinitely. However, it will
#          also keep all your messages if they scroll off the console.
  append = "/var/spool/bacula/log" = all, !skipped
  catalog = all
}

#
# 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 = xxxx@asahi.email.ne.jp = all, !skipped            
  console = all, !skipped, !saved
  append = "/var/log/bacula.log" = all, !skipped
}

# Default pool definition
Pool {
  Name = Default
  Pool Type = Backup
  Maximum Volume Jobs = 1	# これを指定しないと、同一ファイルに追記し差分や増分のファイルも一つになる
  Recycle = yes			# Bacula can automatically recycle Volumes
  AutoPrune = yes		# Prune expired volumes
  Volume Retention = 3 months	# 3ヶ月
}

# File Pool definition
Pool {
  Name = File
  Pool Type = Backup
  Maximum Volume Jobs = 1	# これを指定しないと、同一ファイルに追記し差分や増分のファイルも一つになる
  Recycle = yes			# Bacula can automatically recycle Volumes
  AutoPrune = yes		# Prune expired volumes
  Volume Retention = 3 months	# 3ヶ月
  Maximum Volume Bytes = 50G	# Limit Volume size to something reasonable
  Maximum Volumes = 200		# Limit number of Volumes in Pool
  Label Format = "Vol-"
}

# Scratch pool definition
# この定義を使っているものは無いが、defaultで存在していたので、残してある。多分無くてもOK
Pool {
  Name = Scratch
  Pool Type = Backup
}

# Restricted console used by tray-monitor to get the status of the director
#
Console {
  Name = bacula-mon
  Password = "xxxxxx"
  CommandACL = status, .status
}

Write Bootstrapにある%c.bsrはclientの名前に展開される。この場合はsamba-fd.bsrとweb-fd.bsr。%n.bsrはこのJebDefsを使っているjobの名前に変換される。この場合はCatalog-samba.bsr。
各パスワードはデーターベースbacluaのパスワードしか登録していないので、全部に同じパスワードを指定する。
私は後で出てくるbacula-sd.confのDevice{ でArchive Device で/Backup(バックアップしたデーターを保存する場所)を指定しているが、物理的に独立したHDDにする事、またもちろんバックアップ対象には入れない。
Schedule { Name = "WeeklyCycle"は、これで毎月最初の日曜日にフルバックアップし、それ以外の日曜日に差分バックアップし、それ以外の日では増分バックアップをすると言う設定。
Schedule { の Name = "WeeklyCycleAfterBackup"はバックアップが行われたら、その後にカタログを作るためにこのスケジュールがある。JobDefs{ のCatalogJobの所に Priority = 11 があるので、バックアップが終わってからスタートする。
リストア時に保存されるDirectoryを作っておく。(/Backup/Restores/sambaなど)

Printer Friendly Page Send this Story to a Friend
 
投稿された内容の著作権はコメントの投稿者に帰属します。
テーマ選択

(4 テーマ)
ピックアップ画像
IMG_00132007_11_14 07鐚
最近の画像
IMG_0004.jpg (2023-3-17)
IMG_0004.jpg
IMG_0003.jpg (2023-3-17)
IMG_0003.jpg
IMG_0010.jpg (2023-3-17)
IMG_0010.jpg
IMG_0013.jpg (2023-3-17)
IMG_0013.jpg
IMG_0007.jpg (2023-3-17)
IMG_0007.jpg
IMG_0005.jpg (2023-3-17)
IMG_0005.jpg
IMG_0002.jpg (2023-3-17)
IMG_0002.jpg
IMG_0011.jpg (2023-3-17)
IMG_0011.jpg
IMG_0009.jpg (2023-3-17)
IMG_0009.jpg
IMG_0008.jpg (2023-3-17)
IMG_0008.jpg
人気画像
ゴーキョピー... (6001 hits)
ゴーキョピー...
ギャチュンカ... (5863 hits)
ギャチュンカ...
ばあちゃんミ... (5763 hits)
ばあちゃんミ...
ヒマラヤ壁 (5671 hits)
ヒマラヤ壁
タムセルク残... (5478 hits)
タムセルク残...
Powered by Xoops2 Theme Modified by F-Otake
copyright (c) 2006 All rights reserved.