当初、何でもいいから動作する手順が確立できればいいかなと考えましたが、ちょっとそれは違うかいなぁ・・と思い、以下の構成をとってみる事にしました。またもや今回実験台・・
今回の目的は、リモートバックアップと言うことで、当BLOGにかかわる各種データの採取を目的としました。これまでBackup Exec Remote Agent for Linux Serversを使用していましたが、評価期限が切れるたびに環境再構築するのに疲れたが理由です^^;baculaが考慮すべきは青枠で囲んだ個所になります。これらを踏まえたDEMETER側の設定について今回は述べたいと思います。
まず、bacula-dir.conf
Director設定は以下の通り。
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設定は以下の通り。特にデフォルトから変更はしていません。
JobDefs {
Name = “DefaultJob”
Type = Backup
Level = Incremental
Client = demeter-fd
FileSet = “Full Set”
Schedule = “WeeklyCycle”
Storage = File
Messages = Standard
Pool = Default
Priority = 10
}
ジョブとして、以下の設定を追加します。名前は我が家の命名規則に従って命名しています。Client及びFileSet、Schedule、Pool、Storageの設定を変更しています。常に振るバックアップとする為にLevel=FULLとしています。
Job {
Name = “JB_BK_GAIA_LOGS”
Client = gaia-fd
JobDefs = “DefaultJob”
Level = Full
Write Bootstrap = “/var/lib/bacula/JB_BK_GAIA_LOGS.bsr”
FileSet = “FS_GAIA_LOGS”
Schedule = “SC_JB_GAIADATA”
Storage = STR_FS_DATA
Pool = PL_GAIA
Messages = Standard
}
FileSetは以下のモノを追加しています。GAIAの中でバックアップする対象となるディレクトリを指定します。一応間違ってバックアップされるのもあれなので、Exclude設定はデフォルトのモノを流用させて頂いております。なお、GZIP圧縮も一瞬考えましたが、バックアップ先ストレージはそれなりに余裕があるので敢えて掛けていません。
FileSet {
Name = “FS_GAIA_LOGS”
Include {
Options {
signature = MD5
}
File = /var/log
File = /home
File = /etc
}
Exclude {
File = /proc
File = /tmp
File = /.journal
File = /.fsck
}
}
Scheduleには以下のモノを追加しました。
Schedule {
Name = “SC_JB_GAIADATA”
Run = Full sun-sat at 09:30
}
Clientには以下のモノを追加しております。これが、所謂リモートサーバ上のbacula-fdに対するアクセス設定ですね。
Client {
Name = gaia-fd
Address = www.bluecore.net
FDPort = 9102
Catalog = MyCatalog
Password = “xz5ZkmvBB9yrBoNqqf/3EPg2QrIAvP9glr5TVBDP8E1s”
File Retention = 30 days
Job Retention = 6 months
AutoPrune = yes
}
Storageには以下の設定を追加。これは接続先をローカルのbacula-sdに設定するのだが、その際bacula-sd上で定義しているDeviceとリンクさせる形での設定を行う。
Storage {
Name = STR_FS_DATA
Address = demeter
SDPort = 9103
Password = “Q4YJl5yXxPXtPaJzeGT69Enb1QAwg0nN7imEBqUnZb2a” # Console password
Device = FS_DATAVOL
Media Type = File
}
Poolには以下の設定を追加。デフォルト設定だと1つのファイルに延々と書き込みを行ってしまう為、バックアップデータセットとバックアップ先となるファイルを1対1で紐つけるためにMaximum Volume Jobsを1に設定している。また、2週間保管を想定し、Maximum Volumesは14日分+1巻として15に定義している。(あれ・・3週間分確保した方がよかったかなぁ・・)
Pool {
Name = PL_GAIA
Pool Type = Backup
Recycle = yes
AutoPrune = yes
Volume Retention = 14 days
Maximum Volume Jobs = 1
Label Format = GAIA-
Maximum Volumes = 15
}
続いてbacula-sd.conf
ここではDeviceとして1つFileバックアップ先を定義する。Archive Deviceにてバックアップ先となるディレクトリを定義することになる。
Device {
Name = FS_DATAVOL
Media Type = File
Archive Device =/bacula-data/DEV_GAIA
# Archive Device = /var/backup
LabelMedia = yes;
Random Access = Yes;
AutomaticMount = yes;
RemovableMedia = no;
AlwaysOpen = yes;
}
でもって、これはGAIAサーバのbacula-fd.conf。導入手順自体は前回のネタで提供した手順と同等ですが、導入するパッケージはclientだけに絞っています。
Directorでは、Directorへアクセスするためのパスワード及びDirector側の設定に合わせた名前を定義する。これ以外はデフォルトで問題ない。
Director {
Name = demeter-dir
Password = “xz5ZkmvBB9yrBoNqqf/3EPg2QrIAvP9glr5TVBDP8E1s”
}
さて、次はバックアップ操作に関して整理してみる。今のところ触っているツールはbconsoleと呼ばれるコマンドベースのツールである。
[root@demeter ~]# bconsole
Connecting to Director demeter:9101
1000 OK: demeter-dir Version: 3.0.1 (30 April 2009)
Enter a period to cancel a command.
*
このコマンドを実行すると、コンソールはbacula-dirに接続し、プロンプトが「*」となっている事が分かる。ここから各種バックアップに関する操作を行うことになる。と言うわけでヘルプを見てみる。
*help
Command Description
======= ===========
add add [pool=<pool-name> storage=<storage> jobid=<JobId>] — add media to a pool
autodisplay autodisplay [on|off] — console messages
automount automount [on|off] — after label
cancel cancel [jobid=<number> job=<job-name> ujobid=<unique-jobid>] — cancel a job
create create [pool=<pool-name>] — create DB Pool from resource
delete delete [volume=<vol-name> pool=<pool-name> job jobid=<id>]
disable disable <job=name> — disable a job
enable enable <job=name> — enable a job
estimate performs FileSet estimate, listing gives full listing
exit exit = quit
gui gui [on|off] — non-interactive gui mode
help print this command
label label a tape
list list [pools | jobs | jobtotals | media <pool=pool-name> | files <jobid=nn> | copies <jobid=nn>]; from catalog
llist full or long list like list command
messages messages
memory print current memory usage
mount mount storage=<storage-name> [ slot=<num> ] [ drive=<num> ] or mount [ jobid=<id> | job=<job-name> ]
prune prune files|jobs|volume client=<client-name> volume=<volume-name> prune expired records from catalog
purge purge records from catalog
python python control commands
quit quit
query query catalog
restore restore files
relabel relabel storage=<storage-name> oldvolume=<old-volume-name> volume=<newvolume-name> — relabel a tape
release release <storage-name>
reload reload conf file
run run job=<job-name> client=<client-name> fileset=<FileSet-name> level=<level-keyword> storage=<storage-name> where=<directory-prefix> when=<universal-time-specification> yes
status status [all | dir=<dir-name> | director | client=<client-name> | storage=<storage-name> | days=nnn]
setdebug setdebug level=nn [trace=0/1 client=<client-name> | dir | director | storage=<storage-name> | all] — sets debug level
setip sets new client address — if authorized
show show (resource records) [jobs | pools | … | all]
sqlquery use SQL to query catalog
time print current time
trace turn on/off trace to file
unmount unmount storage=<storage-name> [ drive=<num> ] or unmount [ jobid=<id> | job=<job-name> ]
umount umount – for old-time Unix guys, see unmount
update update Volume, Pool or slots
use use <database-name> — catalog xxx
var does variable expansion
version print Director version
wait wait [<jobname=name> | <jobid=nnn> | <ujobid=complete_name>] — wait until no jobs are runningWhen at a prompt, entering a period cancels the command.
ひとまず今回の為に狙って作った定義済みジョブを実行してみる。
*run ←runコマンドで定義済みジョブの即時実行が可能になる。
Automatically selected Catalog: MyCatalog
Using Catalog “MyCatalog”
A job name must be specified.
The defined Job resources are:
1: Client1
2: JB_BK_GAIA_LOGS
3: BackupCatalog
4: RestoreFiles
Select Job resource (1-4): 2 ←今回作成したJB_BK_GAIA_LOGSを即時実行する。
Run Backup job
JobName: JB_BK_GAIA_LOGS
Level: Full
Client: gaia-fd
FileSet: FS_GAIA_LOGS
Pool: PL_GAIA (From Job resource)
Storage: STR_FS_DATA (From Job resource)
When: 2009-10-04 16:52:41
Priority: 10
OK to run? (yes/mod/no): yes ←この設定でよければ「yes」と入力してEnter
Job queued. JobId=20
*
これでジョブはキューイングされた事になる。ジョブIDは20であることが分かる。これ以降の状態のトレースにはstatusコマンドを使用する。注目点は赤文字+ボールド+イタリック+下線で示しておきます。
*status
Status available for:
1: Director
2: Storage
3: Client
4: All
Select daemon type for status (1-4): 4
demeter-dir Version: 3.0.1 (30 April 2009) i686-redhat-linux-gnu redhat
Daemon started 04-10009 16:28, 0 Jobs run since started.
Heap: heap=253,952 smbytes=58,476 max_bytes=97,884 bufs=290 max_bufs=295Scheduled Jobs:
Level Type Pri Scheduled Name Volume
===================================================================================
Full Backup 10 04-10009 23:05 Client1 TEST03
Full Backup 11 04-10009 23:10 BackupCatalog TEST03
Full Backup 10 05-10009 09:30 JB_BK_GAIA_LOGS *unknown*
====Running Jobs:
Console connected at 04-10009 16:52
JobId Level Name Status
======================================================================
20 Full JB_BK_GAIA_LOGS.2009-10-04_16.52.46_03 is running
====Terminated Jobs:
JobId Level Files Bytes Status Finished Name
====================================================================
10 Full 0 0 Error 04-10009 14:43 BackupCatalog
11 Full 1 26.63 K OK 04-10009 14:44 BackupCatalog
12 Full 0 0 Error 04-10009 14:54 JB_BK_GAIA_LOGS
13 Full 0 0 Error 04-10009 14:57 JB_BK_GAIA_LOGS
14 Full 0 0 Error 04-10009 14:59 JB_BK_GAIA_LOGS
15 Full 63 1.060 M OK 04-10009 14:59 JB_BK_GAIA_LOGS
16 Full 0 0 Error 04-10009 15:10 JB_BK_GAIA_LOGS
17 Full 134 42.00 M OK 04-10009 15:11 JB_BK_GAIA_LOGS
18 Incr 3 330.8 K OK 04-10009 15:18 JB_BK_GAIA_LOGS
19 Full 43,982 5.556 G OK 04-10009 16:14 JB_BK_GAIA_LOGS====
Connecting to Storage daemon File at demeter:9103demeter-sd Version: 3.0.1 (30 April 2009) i686-redhat-linux-gnu redhat
Daemon started 04-10009 15:13, 2 Jobs run since started.
Heap: heap=266,240 smbytes=159,647 max_bytes=224,924 bufs=111 max_bufs=119
Sizes: boffset_t=8 size_t=4 int32_t=4 int64_t=8Running Jobs:
Writing: Full Backup job JB_BK_GAIA_LOGS JobId=20 Volume=”GAIA-0010″
pool=”PL_GAIA” device=”FS_DATAVOL” (/bacula-data/DEV_GAIA)
spooling=0 despooling=0 despool_wait=0
Files=141 Bytes=55,535,677 Bytes/sec=18,511,892
FDReadSeqNo=1,915 in_msg=1551 out_msg=5 fd=6
====Jobs waiting to reserve a drive:
====Terminated Jobs:
JobId Level Files Bytes Status Finished Name
===================================================================
10 Full 0 0 Error 04-10009 14:43 BackupCatalog
11 Full 1 26.74 K OK 04-10009 14:44 BackupCatalog
12 Full 0 0 Cancel 04-10009 14:54 JB_BK_GAIA_LOGS
13 Full 0 0 Cancel 04-10009 14:57 JB_BK_GAIA_LOGS
14 Full 0 0 Cancel 04-10009 14:59 JB_BK_GAIA_LOGS
15 Full 63 1.066 M OK 04-10009 14:59 JB_BK_GAIA_LOGS
16 Full 0 0 Error 04-10009 15:10 JB_BK_GAIA_LOGS
17 Full 134 42.02 M OK 04-10009 15:11 JB_BK_GAIA_LOGS
18 Incr 3 331.1 K OK 04-10009 15:18 JB_BK_GAIA_LOGS
19 Full 43,982 5.563 G OK 04-10009 16:14 JB_BK_GAIA_LOGS
====Device status:
Device “FileStorage” (/bacula-data/DEV_DEFAULT) is not open.
Device “FS_DATAVOL” (/bacula-data/DEV_GAIA) is mounted with:
Volume: GAIA-0010
Pool: PL_GAIA
Media type: File
Total Bytes=55,545,040 Blocks=861 Bytes/block=64,512
Positioned at File=0 Block=55,545,039
====Used Volume status:
GAIA-0010 on device “FS_DATAVOL” (/bacula-data/DEV_GAIA)
Reader=0 writers=1 devres=0 volinuse=1
========
Connecting to Client demeter-fd at demeter.bluecore.net:9102
demeter-fd Version: 3.0.1 (30 April 2009) i686-redhat-linux-gnu redhat
Daemon started 04-10009 13:51, 4 Jobs run since started.
Heap: heap=532,480 smbytes=145,031 max_bytes=218,710 bufs=60 max_bufs=97
Sizeof: boffset_t=8 size_t=4 debug=0 trace=0Running Jobs:
Director connected at: 04-10009 16:52
No Jobs running.
====Terminated Jobs:
JobId Level Files Bytes Status Finished Name
======================================================================
1 Full 1 22.90 K OK 04-10009 02:18 BackupCatalog
2 1 22.90 K OK 04-10009 08:59 RestoreFiles
6 Full 0 0 Error 04-10009 14:26 BackupCatalog
10 Full 0 0 Cancel 04-10009 14:43 BackupCatalog
11 Full 1 26.63 K OK 04-10009 14:44 BackupCatalog
15 Full 63 1.060 M OK 04-10009 14:59 JB_BK_GAIA_LOGS
====
Connecting to Client gaia-fd at www.bluecore.net:9102gaia-fd Version: 3.0.1 (30 April 2009) i686-redhat-linux-gnu redhat
Daemon started 04-10009 13:33, 4 Jobs run since started.
Heap: heap=675,840 smbytes=228,836 max_bytes=245,845 bufs=129 max_bufs=159
Sizeof: boffset_t=8 size_t=4 debug=0 trace=0Running Jobs:
JobId 20 Job JB_BK_GAIA_LOGS.2009-10-04_16.52.46_03 is running.
Backup Job started: 04-10009 16:52
Files=145 Bytes=65,279,941 Bytes/sec=16,319,985 Errors=0
Files Examined=145
Processing file: /home/bk_mysql/snapshot/20090916/worddb.tar
SDReadSeqNo=5 fd=5
Director connected at: 04-10009 16:52
====Terminated Jobs:
JobId Level Files Bytes Status Finished Name
======================================================================
16 Full 0 0 Error 04-10009 15:10 JB_BK_GAIA_LOGS
17 Full 134 42.00 M OK 04-10009 15:11 JB_BK_GAIA_LOGS
18 Incr 3 330.8 K OK 04-10009 15:18 JB_BK_GAIA_LOGS
19 Full 43,982 5.556 G OK 04-10009 16:13 JB_BK_GAIA_LOGS
====
You have messages.
*
これら示した情報の中で、データバックアップが行われている状況をトレースすることが可能となる。完了すると、以下のように完了通知がメールで通知される。
Build OS: i686-redhat-linux-gnu redhat
JobId: 20
Job: JB_BK_GAIA_LOGS.2009-10-04_16.52.46_03
Backup Level: Full
Client: “gaia-fd” 3.0.1 (30Apr09) i686-redhat-linux-gnu,redhat,
FileSet: “FS_GAIA_LOGS” 2009-10-04 16:02:22
Pool: “PL_GAIA” (From Job resource)
Catalog: “MyCatalog” (From Client resource)
Storage: “STR_FS_DATA” (From Job resource)
Scheduled time: 04-10月-2009 16:52:41
Start time: 04-10月-2009 16:52:48
End time: 04-10月-2009 17:04:39
Elapsed time: 11 mins 51 secs
Priority: 10
FD Files Written: 43,981
SD Files Written: 43,981
FD Bytes Written: 5,556,381,960 (5.556 GB)
SD Bytes Written: 5,563,077,969 (5.563 GB)
Rate: 7814.9 KB/s
Software Compression: None
VSS: no
Encryption: no
Accurate: no
Volume name(s): GAIA-0010
Volume Session Id: 3
Volume Session Time: 1254636798
Last Volume Bytes: 5,568,604,883 (5.568 GB)
Non-fatal FD errors: 0
SD Errors: 0
FD termination status: OK
SD termination status: OK
Termination: Backup OK
正直、ここまできっちり運用できそうな気のするフリーのバックアップソフトウェアって生まれて初めて見た。
もう少ししっかり使い込めば、もしかしたら商売としても使えるレベルに達するかもしれませんね。ただ、EMCのNetwalkerよりもひどいくらいにCUI頼みなソフトウェアなので、まぁ・・まだ使うにしても個人環境が限界なのかもしれません^^;
No responses yet