ログイン
ユーザ名:

パスワード:


パスワード紛失

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

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

もっと...
投稿者: f-otake 投稿日時: 2015-7-5 8:27:20 (1047 ヒット)

今までBuilding directory treeに時間が掛かっていたのはMYSQLの設定だった。
時間が掛かりすぎるのでbacluaのメーリングリストで聞いたら、やっぱりおかしいようだ。
一番の問題点はMYSQLのデーターベースエンジンに MyISAMを使っている事みたい。
これをInnoDBに変更する。ALTER TABLE テーブル名 ENGINE=InnoDB; を行なえと書いてあるが、データーベースごとそっくり変更出来ないかと調べたが、テーブル単位でしか出来ないようだ。
それではとデーターベースをエクスポートして、データーベース名を変更し、新規にbaculaをInnoDBで作り、インポートしたらおかしくなっていた。インポートしたファイルを見るとDBの指定がMyISAMになっていた。
面倒くさいので、既存のDBのテーブルを一つずつInnoDBにしてから
http://bacula.us/tuning/ にあるように /etc/my.cnf に

    sort_buffer_size = 2MB
    default-storage-engine=INNODB ←今後作るdatabaseのエンジンをINNODBにする
    innodb_buffer_pool_size = 128MB
    innodb_flush_log_at_trx_commit = 0
    innodb_flush_method = O_DIRECT
を追記し、mysqlを再起動、テストで
+-------+-------+----------+---------------+---------------------+------------+
| JobId | Level | JobFiles | JobBytes      | StartTime           | VolumeName |
+-------+-------+----------+---------------+---------------------+------------+
|     4 | F     |  258,441 | 2,262,481,683 | 2015-07-02 14:32:50 | Vol-0004   |
|    14 | I     |      158 |    79,623,411 | 2015-07-03 04:32:49 | Vol-0014   |
+-------+-------+----------+---------------+---------------------+------------+
You have selected the following JobIds: 4,14
Building directory tree for JobId(s) 4,14 ...
のケースではBuilding directory treeに5時間20分(リストア全体の時間ではない、Building directory treeだけにかかった時間)掛かっていたのが、10秒位で終わった。
何だこれは!!こんなに違うの!!そういえば以前は”Building directory tree”の時CPUのユーティライゼションが100%になっていた。この時SWAPの状態をチェックしていなかったが、もしかしたらSWAPが大量に発生していたのかも?
【結論】baculaでmysqlを使うときは絶対にDBのベースエンジンは InnoDB にし、上記の設定を追加する事


投稿者: f-otake 投稿日時: 2015-7-3 13:27:47 (1008 ヒット)

この前に11:リストアの時間が劇的に早くなったを参照の事。
どうもリストア時のファイルの作成(Building directory tree)に時間がかかりすぎる

+-------+-------+----------+---------------+---------------------+------------+
| JobId | Level | JobFiles | JobBytes      | StartTime           | VolumeName|
+-------+-------+----------+---------------+---------------------+------------+
|     4 | F     |  258,441 | 2,262,481,683 | 2015-07-02 14:32:50 | Vol-0004   |
|    14 | I     |      158 |    79,623,411 | 2015-07-03 04:32:49 | Vol-0014   |
+-------+-------+----------+---------------+---------------------+------------+
 You have selected the following JobIds: 4,14
 Building directory tree for JobId(s) 4,14 ...  +++++++++++++++++++++++++++++++++++++++++++
224,831 files inserted into the tree.
上記の分で5時間20分もかかっている。
誤解の無いように言っておくが、これはリストアにかかった時間ではない。Building directory treeだけにかかった時間である。
ここで不安になって来た。もし壊れて場合こんなに時間がかかっているとその間はサービスが無い状態になってしまう。
ここから mark * で少し時間がかかり(上にあるように224、831もファイルがあるのでそれに印を付けるため)それから、いよいよリストアになりこれにも時間がかかる。
上の場合はフルバックアップと一つのインクリメントファイルだけである。最悪の場合(土曜日の時)フル、差分、6個のインクリメントの計8個のファイルを使って、リストアするファイルを作るとすれば、一体どれだけ時間がかかるの?
それとも私のやり方が間違っているの?どれだけ時間がかかるか調べて見ようか。


投稿者: f-otake 投稿日時: 2015-6-19 18:46:43 (765 ヒット)

8:他のホストにリストアでも言っていますが、バックアップされるホストの全てのファイルを(マウントしている他の領域の分も含めて)FileSetで指定してしまうと、リストア時にものすごく時間がかかってしまいます。ちなみに私はあるホストには/領域で6.7GB、マウントしている領域で2.4GBもう一つの領域で9.9GBをバックアップしたら、リストア時に8時間以上かかってしまいました。(バックアップされたサイズは10.9GB)なので、方針を変更し、マウントしている領域はrsync(baculaでもいいが)で、作成しているバックアップ用のホストに1日1回同期させる様にしました。(マウントしている領域はWEBのデーターやmailのデーター領域等など、全てデーター領域です)
これで今日フルバックアップ(バックアップされたサイズは2.2GB)したので、後日リストアしてみてどれくらいの時間がかかるか報告します。


投稿者: f-otake 投稿日時: 2015-5-10 10:23:14 (23696 ヒット)

バックアップしたデーターをリストアする時には同じホストへリストア(デフォルトの設定)すると、ディスクの空き容量が足りない事があります(使用容量と同じより大きい空きスペースがいる)。
私は大容量のディスクがある、バックアップサーバーにリストアしますが、これまでその方法が判らなかったのですが(回答がインターネットにあまり無い)。
やっと方法が判りましたが、簡単でした。ここをクリックし、最後の
OK to run? (yes/mod/no): まで進んで下さい。そこで下記のようにすると他のホストにリストアします

OK to run? (yes/mod/no): m
Parameters to modify:
      1: Level
      2: Storage
      3: Job
      4: FileSet
      5: Restore Client
      6: When
      7: Priority
      8: Bootstrap
      9: Where
     10: File Relocation
     11: Replace
     12: JobId
     13: Plugin Options
Select parameter to modify (1-13): 5
The defined Client resources are:
      1: smb5-fd
      2: kvm5-fd
      3: web5-fd
Select Client (File daemon) resource (1-3): 1
Run Restore job JobName:         Restore-web5
Bootstrap:       /var/spool/bacula/bacula-dir.restore.1.bsr
Where:           /Backup/Restores/web5
Replace:         always
FileSet:         Full web5
Backup Client:   web5-fd
Restore Client:  smb5-fd
Storage:         File
When:            2015-05-10 10:06:20
Catalog:         MyCatalog Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): y
この意味はmで編集を選び、5でリストアされたファイルを保存するホスト選択にし、1でディスク容量の余っているホストに保存の指定をし、yでリストアを始めます。
ここで気を付けなければならないのは、本体でディスクを分けてマウントしていても、リストアした分は( / ルート)以下がすべてリストアされますのでマウントしていたディスクのすべての使用容量分の空きスペースがいります。


投稿者: f-otake 投稿日時: 2013-12-11 11:45:54 (2359 ヒット)

そろそろバックアップデーターも貯まって来たのでリストアをためします。

# bconsole
Connecting to Director 192.168.135.60:9101
1000 OK: bacula-dir Version: 5.0.0 (26 January 2010)
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: samba-fd
     2: web-fd
Select the Client (1-2): 2
The defined FileSet resources are:
     1: Catalog
     2: Full web
Select FileSet resource (1-2): 2
+-------+-------+----------+----------------+---------------------+------------+
| JobId | Level | JobFiles | JobBytes       | StartTime           | VolumeName |
+-------+-------+----------+----------------+---------------------+------------+
|   214 | F     |  326,050 | 24,520,406,195 | 2013-12-03 02:16:20 | Vol-0132   |
|   229 | D     |    2,409 |    103,565,858 | 2013-12-08 02:10:13 | Vol-0147   |
|   232 | I     |   50,884 |    680,830,900 | 2013-12-09 02:06:08 | Vol-0150   |
|   237 | I     |   86,776 |  1,018,653,845 | 2013-12-10 02:06:18 | Vol-0153   |
+-------+-------+----------+----------------+---------------------+------------+
You have selected the following JobIds: 214,229,232,237

Building directory tree for JobId(s) 214,229,232,237 ...  

コンソールを立ち上げ、restoreコマンドをして、直近のバックアップを選び(5)、クライアントを選択し、ファイルセットを選べば上記のような表示になります。最初のフルバックアップが示すように、圧縮後でも24Gもあるので、ここからすごく時間がかかります。私の場合は約4時間位かっかたみたいです。11:リストアの時間が劇的に早くなった を参照の事、全然早くなる
ともかく
386,584 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: /
$ mark *
431,973 files marked.
$ done
Bootstrap records written to /var/spool/bacula/bacula-dir.restore.1.bsr

The job will require the following
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================
   
    Vol-0132                  File                      FileStorage              
    Vol-0147                  File                      FileStorage              
    Vol-0150                  File                      FileStorage              
    Vol-0153                  File                      FileStorage              

Volumes marked with "*" are online.


431,973 files selected to be restored.

The defined Restore Job resources are:
     1: Restore-samba
     2: Restore-web
Select Restore Job (1-2): 2
Run Restore job
JobName:         Restore-web
Bootstrap:       /var/spool/bacula/bacula-dir.restore.1.bsr
Where:           /Backup/BackupTemp/web
Replace:         always
FileSet:         Full web
Backup Client:   web-fd
Restore Client:  web-fd
Storage:         File
When:            2013-12-11 19:43:33
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=239
*
11-12月 19:43 bacula-dir JobId 239: Start Restore Job Restore-web.2013-12-11_19.43.40_04
11-12月 19:43 bacula-dir JobId 239: Using Device "FileStorage"
11-12月 19:43 bacula-sd JobId 239: Ready to read from volume "Vol-0132" on device "FileStorage" (/Backup).
11-12月 19:43 bacula-sd JobId 239: Forward spacing Volume "Vol-0132" to file:block 0:204.

mark * で全部に印を付け、doneでマークの作業を終われせ、2 でリストアするJOB(ホストの指定)し、yes でリストアの実行をします。
しばらくするとメールが着た。内容は下記の通り
11-12月 20:18 bacula-sd JobId 239: End of Volume at file 5 on device "FileStorage" (/Backup), Volume "Vol-0132"
11-12月 20:18 bacula-sd JobId 239: Ready to read from volume "Vol-0147" on device "FileStorage" (/Backup).
11-12月 20:18 bacula-sd JobId 239: Forward spacing Volume "Vol-0147" to file:block 0:204.
11-12月 20:18 bacula-sd JobId 239: End of Volume at file 0 on device "FileStorage" (/Backup), Volume "Vol-0147"
11-12月 20:18 bacula-sd JobId 239: Ready to read from volume "Vol-0150" on device "FileStorage" (/Backup).
11-12月 20:18 bacula-sd JobId 239: Forward spacing Volume "Vol-0150" to file:block 0:204.
11-12月 20:19 bacula-sd JobId 239: End of Volume at file 0 on device "FileStorage" (/Backup), Volume "Vol-0150"
11-12月 20:19 bacula-sd JobId 239: Ready to read from volume "Vol-0153" on device "FileStorage" (/Backup).
11-12月 20:19 bacula-sd JobId 239: Forward spacing Volume "Vol-0153" to file:block 0:204.
11-12月 20:21 bacula-sd JobId 239: End of Volume at file 0 on device "FileStorage" (/Backup), Volume "Vol-0153"
11-12月 20:21 bacula-sd JobId 239: End of all volumes.
11-12月 20:21 bacula-dir JobId 239: Bacula bacula-dir 5.0.0 (26Jan10): 11-12月-2013 20:21:30
  Build OS:               x86_64-redhat-linux-gnu redhat 
  JobId:                  239
  Job:                    Restore-web.2013-12-11_19.43.40_04
  Restore Client:         web-fd
  Start time:             11-12月-2013 19:43:42
  End time:               11-12月-2013 20:21:30
  Files Expected:         431,973
  Files Restored:         431,973
  Bytes Restored:         30,557,020,587
  Rate:                   13473.1 KB/s
  FD Errors:              0
  FD termination status:  OK
  SD termination status:  OK
  Termination:            Restore OK

11-12月 20:21 bacula-dir JobId 239: Begin pruning Jobs older than 43 years 5 months 25 days 11 hours 21 mins 30 sec.
11-12月 20:21 bacula-dir JobId 239: No Jobs found to prune.
11-12月 20:21 bacula-dir JobId 239: Begin pruning Jobs.
11-12月 20:21 bacula-dir JobId 239: Pruned Files from 4 Jobs for client web-fd from catalog.
11-12月 20:21 bacula-dir JobId 239: End auto prune.

19:43にリストアが始まり、20:21に終わり、約30GBをリストアした。


投稿者: f-otake 投稿日時: 2013-12-4 13:13:47 (1262 ヒット)

firewallのTCP 9101から9103を開けておきます。
いよいよbacula(mysqlも)を走らせます。
# service mysqld start
# service bacula-sd start
# service bacura-fd start
# service bacula-dir start
この起動順はあまり関係無いと思うが、どこかのWEBでこの順番だったので。又、再起動にそなえ
# chkconfig mysqld on
# chkconfig bacula-dir on
# chkconfig bacula-sd on
# chkconfig bacula-fd on
もう一つあるホストでも
# service bacula-fd start
# chkconfig bacula-fd on
コンソールを走らせます。bacula-dirをインストールしたホストで
# bconsole
Connecting to Director localhost:9101
1000 OK: bacula-dir Version: 5.0.0 (26 January 2010)
Enter a period to cancel a command.
*
status all
bacula-dir Version: 5.0.0 (26 January 2010) x86_64-redhat-linux-gnu redhat
Daemon started 04-12��2013 19:33, 0 Jobs run since started.
Heap: heap=270,336 smbytes=46,669 max_bytes=47,246 bufs=226 max_bufs=227

Scheduled Jobs:
Level Type Pri Scheduled Name Volume
===================================================================================
Incremental Backup 10 05-12��2013 02:05 Backup-samba *unknown*
Incremental Backup 10 05-12��2013 02:05 Backup-web *unknown*
Full Backup 11 05-12��2013 02:10 Catalog-samba *unknown*
====

Running Jobs:
Console connected at 04-12��2013 19:35
No Jobs running.
====
No Terminated Jobs.
====
Connecting to Storage daemon File at 192.168.135.65:9103

bacula-sd Version: 5.0.0 (26 January 2010) x86_64-redhat-linux-gnu redhat
Daemon started 04-12��2013 19:33, 0 Jobs run since started.
Heap: heap=135,168 smbytes=13,943 max_bytes=77,749 bufs=53 max_bufs=54
Sizes: boffset_t=8 size_t=8 int32_t=4 int64_t=8

Running Jobs:
No Jobs running.
====

Jobs waiting to reserve a drive:
====

Terminated Jobs:
====

以下、省略
まだ何もバックアップしていないので、こんな感じ表示になると思います。
で、いよいよバックアップを試す。一番最初は自動的にフルバックアップになる見たい。
*run
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
A job name must be specified.
The defined Job resources are:
1: Backup-samba
2: Backup-web
3: Catalog-samba
4: Restore-samba
5: Restore-web
Select Job resource (1-5):
1
Run Backup job
JobName: Backup-samba
Level: Incremental
Client: samba-fd
FileSet: Full samba
Pool: File (From Job resource)
Storage: File (From Job resource)
When: 2013-12-04 19:40:42
Priority: 10
OK to run? (yes/mod/no):
yes
Job queued. JobId=1
You have messages.
*
message
04-12月 19:41 bacula-dir JobId 1: No prior Full backup Job record found.
04-12月 19:41 bacula-dir JobId 1: No prior or suitable Full backup found in catalog. Doing FULL backup.
04-12月 19:41 bacula-dir JobId 1: Start Backup JobId 1, Job=Backup-samba.2013-12-04_19.41.03_03
04-12月 19:41 bacula-dir JobId 1: Created new Volume "Vol-0001" in catalog.
04-12月 19:41 bacula-dir JobId 1: Using Device "FileStorage"
04-12月 19:41 bacula-sd JobId 1: Labeled new Volume "Vol-0001" on device "FileStorage" (/Backup).
04-12月 19:41 bacula-sd JobId 1: Wrote label to prelabeled Volume "Vol-0001" on device "FileStorage" (/Backup)
04-12月 19:41 bacula-dir JobId 1: Max Volume jobs exceeded. Marking Volume "Vol-0001" as Used.
*

上記は run で Jobを表示させ、1でBackup-sambaを選び、yesでバックアップを開始し、messageでそのメッセージを表示している。
フルバックアップなのでかなり時間がかかる筈。気長に待つことにする。しばらくしてmessageとすると、結果が表示される(この時終わっていなければ、メッセージは無いと言われるので、終わっていない事が解る)
*message
04-12月 19:41 bacula-dir JobId 1: No prior Full backup Job record found.
04-12月 19:41 bacula-dir JobId 1: No prior or suitable Full backup found in catalog. Doing FULL backup.
04-12月 19:41 bacula-dir JobId 1: Start Backup JobId 1, Job=Backup-samba.2013-12-04_19.41.03_03
04-12月 19:41 bacula-dir JobId 1: Created new Volume "Vol-0001" in catalog.
04-12月 19:41 bacula-dir JobId 1: Using Device "FileStorage"
04-12月 19:41 bacula-sd JobId 1: Labeled new Volume "Vol-0001" on device "FileStorage" (/Backup).
04-12月 19:41 bacula-sd JobId 1: Wrote label to prelabeled Volume "Vol-0001" on device "FileStorage" (/Backup)
04-12月 19:41 bacula-dir JobId 1: Max Volume jobs exceeded. Marking Volume "Vol-0001" as Used.
*message
04-12月 19:42 samba-fd JobId 1: /net is a different filesystem. Will not descend from / into /net
04-12月 19:42 samba-fd JobId 1: /sys is a different filesystem. Will not descend from / into /sys
04-12月 19:42 samba-fd JobId 1: /root/.gvfs is a different filesystem. Will not descend from / into /root/.gvfs
04-12月 19:42 samba-fd JobId 1: /dev is a different filesystem. Will not descend from / into /dev
04-12月 19:42 samba-fd JobId 1: /misc is a different filesystem. Will not descend from / into /misc
04-12月 19:42 samba-fd JobId 1: /Download is a different filesystem. Will not descend from / into /Download
04-12月 19:48 bacula-sd JobId 1: Job write elapsed time = 00:07:51, Transfer rate = 3.900 M Bytes/second
04-12月 19:48 bacula-dir JobId 1: Bacula bacula-dir 5.0.0 (26Jan10): 04-12月-2013 19:48:56
Build OS: x86_64-redhat-linux-gnu redhat
JobId: 1
Job: Backup-samba.2013-12-04_19.41.03_03
Backup Level: Full (upgraded from Incremental)
Client: "samba-fd" 5.0.0 (26Jan10) x86_64-redhat-linux-gnu,redhat,
FileSet: "Full samba" 2013-12-04 19:41:03
Pool: "File" (From Job resource)
Catalog: "MyCatalog" (From Client resource)
Storage: "File" (From Job resource)
Scheduled time: 04-12月-2013 19:40:42
Start time: 04-12月-2013 19:41:05
End time: 04-12月-2013 19:48:56
Elapsed time: 7 mins 51 secs
Priority: 10
FD Files Written: 181,795
SD Files Written: 181,795
FD Bytes Written: 1,810,354,266 (1.810 GB)
SD Bytes Written: 1,837,013,316 (1.837 GB)
Rate: 3843.6 KB/s
Software Compression: 60.8 %
VSS: no
Encryption: no
Accurate: no
Volume name(s): Vol-0001
Volume Session Id: 1
Volume Session Time: 1386153227
Last Volume Bytes: 1,843,893,529 (1.843 GB)
Non-fatal FD errors: 0
SD Errors: 0
FD termination status: OK
SD termination status: OK
Termination: Backup OK

04-12月 19:48 bacula-dir JobId 1: Begin pruning Jobs older than 43 years 8 months 18 days 10 hours 48 mins 56 sec.
04-12月 19:48 bacula-dir JobId 1: No Jobs found to prune.
04-12月 19:48 bacula-dir JobId 1: Begin pruning Jobs.
04-12月 19:48 bacula-dir JobId 1: No Files found to prune.
04-12月 19:48 bacula-dir JobId 1: End auto prune.

*

と無事バックアップが終わった。このバックアップに 7 mins 51 secs かかり、そのサイズは 1.843 GB であった。この時のホストの使用量は /:4.7GB, /Smbdata 約300MB でした。(bcomsoleを抜けるにはexitを入力)
そしてメールが来る。他のホスト(Backup-web)と Catalog-samba をやって置く。その後 exit で bconsoleを終了する。
リストアもテストするがもう少しバックアップしたデータが貯まってから試す。


投稿者: f-otake 投稿日時: 2013-12-4 10:53:30 (1004 ヒット)

bacula-fd.confの設定をしていきますが、これはそれぞれのホストに設定をしていきますが、まずはこのホスト自身のバックアップも取るので、その設定
# gedit /etc/bacula/bacula-fd.conf

# List Directors who are permitted to contact this File daemon
Director {
  Name = bacula-dir
  Password = "xxxxx"
}

Director {
  Name = bacula-mon
  Password = "xxxxx"
  Monitor = yes
}

# Restricted Director, used by tray-monitor to get the
#   status of the file daemon
# "Global" File daemon configuration specifications
FileDaemon {                          # this is me
  Name = samba-fd ← bacula-dir.confの名前に合わせる
  FDport = 9102                  # where we listen for the director
  WorkingDirectory = /var/spool/bacula
  Pid Directory = /var/run
  Maximum Concurrent Jobs = 20
}

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

パスワード(データーベースに設定したPW)とName = samba-fd 以外はdefaultのままです。
次にもう一つのホストの設定ですが、その前にインストール
# yum install bacula-client bacula-console
でそのホストにbacula-clientとbacula-consoleをインストール。そして/etc/bacula/bacula-fd.confの設定
Director {
  Name = bacula-dir
  Password = "XXXX"
}

#
# Restricted Director, used by tray-monitor to get the
#   status of the file daemon
#
Director {
  Name = bacula-mon
  Password = "xxxx"
  Monitor = yes
}

#
# "Global" File daemon configuration specifications
#
FileDaemon {                          # this is me
  Name = bacula-fd ← bacula-dir.confの名前に合わせる
  FDport = 9102                  # where we listen for the director
  WorkingDirectory = /var/spool/bacula
  Pid Directory = /var/run
  Maximum Concurrent Jobs = 20
}

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

/etc/bacula/bconsole.confの設定
Director {
  Name = bacula-dir
  DIRport = 9101
  address = 192.168.xxx.xxx ← directorの動いているホストの指定をする
  Password = "xxxxx"
}

2014-07-01追記:basula-fdをスタートさせ、再起動後もスタートするように
# service bacula-fd start
# chkconfig bacula-fd on


投稿者: f-otake 投稿日時: 2013-12-4 10:17:44 (951 ヒット)

bacula-sd.confの設定

Storage {                             # definition of myself
  Name = bacula-sd
  SDPort = 9103                  # Director's port      
  WorkingDirectory = "/var/spool/bacula"
  Pid Directory = "/var/run"
  Maximum Concurrent Jobs = 20
}

# List Directors who are permitted to contact Storage daemon
Director {
  Name = bacula-dir
  Password = "xxxxx"
}

# Restricted Director, used by tray-monitor to get the
#   status of the storage daemon
Director {
  Name = bacula-mon
  Password = "xxxxxx"
  Monitor = yes
}

# Note, for a list of additional Device templates please
#  see the directory <bacula-source>/examples/devices
# Or follow the following link:
#  http://bacula.svn.sourceforge.net/viewvc/bacula/trunk/bacula/examples/devices/

# Devices supported by this Storage daemon
# To connect, the Director's bacula-dir.conf must have the
#  same Name and MediaType. 
Device {
  Name = FileStorage
  Media Type = File
  Archive Device = /Backup ← バックアップfileを保存する場所
  LabelMedia = yes;                   # lets Bacula label unlabeled media
  Random Access = Yes;
  AutomaticMount = yes;               # when device opened, read it
  RemovableMedia = no;
  AlwaysOpen = no;
}

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

パスワード(データーベースに登録したPW)とArchive Device = /Backup以外はデフォールトまま。Archive Device は物理的に別のディスク(このホスト自身のバックアップも取るから)で容量の大きなDiskを使う。

bconsole.confの設定
Director {
  Name = bacula-dir
  DIRport = 9101
  address = localhost
  Password = "xxxxx"
}

パスワード(データーベースに設定したPW)以外はdefaultのままです。


投稿者: f-otake 投稿日時: 2013-12-2 21:06:21 (2504 ヒット)

まずは/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など)


投稿者: f-otake 投稿日時: 2013-12-2 17:46:08 (1569 ヒット)


11:リストアの時間が劇的に早くなった を参照してください。このままでは遅いです。

まずはサーバー側、私はサーバー自身もバックアップするので
# yum install bacula-storage-mysql bacula-director-mysql bacula-console mysql-server bacula-client mysql
とbaclua関連とmysqlをインストールします。baculaは前項の参考URLで示したWEBにあるようにカタログ(内容は参考URLを見てね)と呼ばれるデータをmysqlに保存をしますので、まずはmysqlの設定から(/etc/my.cnf)

[mysqld]
datadir=/XXXX/mysql ← オリジナルの場所から変更しています
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server = utf8 ← 追記

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

そしてmysqlをスタート
# service mysqld start
最初のスタートでは色々と表示が出るが、ようはrootのパスワードを設定しろよと言う事など。忘れないように再起動後も起動するように
# chkconfig mysqld on
そして初期設定をする
# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):  Enterのみを入力
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] Enterのみを入力
New password: パスワードを入力
Re-enter new password: パスワードを再度入力
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]  Enterのみを入力
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]  Enterのみを入力
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]  Enterのみを入力
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]  Enterのみを入力
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

mysqlへログインしデーターベースなどを作成
# mysql -u root -pXXXXXXX ←XXXXXXXは設定したパスワード -pの後にスペースは入れてはいけない
mysql> GRANT ALL PRIVILEGES ON bacula.* TO bacula@localhost IDENTIFIED BY “XXXXXXX”; ← XXXXXXXは設定したいパスワード、後でbaculaのconfファイルに記入する。
mysql> FLUSH PRIVILEGES;
mysql> CREATE DATABASE bacula;
mysql> quit
これでdatabaseが出来ましたので、用意されているスクリプトでtableを作ります。
2019-4-3追記現在私が使用しているmysqlはVer 14.14 Distrib 5.6.43です、これだとこのままではエラーになり(予約語の関係だそうです)修正が必要です。
/usr/libexec/bacula/make_mysql_tables の325行目位にCREATE TABLE Counters ( がありますのでその中身を変更します。
CREATE TABLE Counters (
\`Counter\` TINYBLOB NOT NULL,
\`MinValue\` INTEGER DEFAULT 0,
\`MaxValue\` INTEGER DEFAULT 0,
\`CurrentValue\` INTEGER DEFAULT 0,
\`WrapCounter\` TINYBLOB NOT NULL,
PRIMARY KEY (Counter(128))
);

バックスラッシュの後は ' ではなく ` です、間違えない様に、日本語のキーボードでは @ の上です。
それから下のコマンドを入力してテーブルを作ります。
# /usr/libexec/bacula/make_mysql_tables -pXXXXXX ←XXXXXXは今設定したパスワード
Creation of Bacula MySQL tables succeeded.
次はいよいよbaculaの設定


(1) 2 »
テーマ選択

(4 テーマ)
ミニカレンダー
前月2024年 3月翌月
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
<今日>
ピックアップ画像
茵?
最近の画像
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
人気画像
ゴーキョピー... (5991 hits)
ゴーキョピー...
ギャチュンカ... (5851 hits)
ギャチュンカ...
ばあちゃんミ... (5750 hits)
ばあちゃんミ...
ヒマラヤ壁 (5658 hits)
ヒマラヤ壁
タムセルク残... (5467 hits)
タムセルク残...
Powered by Xoops2 Theme Modified by F-Otake
copyright (c) 2006 All rights reserved.