baculaをインストールしてみる

電脳備忘録

baculaをインストールする環境が整ったのでインストール&各種設定を実施してみたときの備忘録。
baculaはフルバックアップ・差分バックアップ・増分バックアップが取れるのはもちろんのこと、ネットワーク越しにバックアップもできるみたいです。設定方法を十分理解して使いこなすことが出れば強力なツールであることは間違いなさそうですね。ただ、ネット上にソースがあまり転がっていないようなので色々と苦労しそうな予感。まあこういったツールには苦労はつき物ということで・・・。

お約束

参照は自己責任でお願いします。

インストールをする前に

あらかじめリポジトリを追加しておきましょう。追加方法は過去エントリーのCentOSリポジトリ(EPEL)の追加を参考にしてみてください。

インストール

インストールするにあたりこちらのサイトを参考にさせていただきました。

Directorデーモン・Storageデーモン・Console・Baculaクライアントをインストール。
# yum -y install bacula-director
# yum -y install bacula-storage
# yum -y install bacula-console
# yum -y install bacula-client
DB作成
# /usr/libexec/bacula/create_bacula_database.mysql
Creating MySQL database
Creation of bacula database succeeded.
テーブル作成
/usr/libexec/bacula/make_bacula_tables.mysql
Making MySQL tables
Creation of Bacula MySQL tables succeeded.
権限の付与
# /usr/libexec/bacula/grant_bacula_privileges.mysql
Granting MySQL privileges
・
・
・
Privileges for bacula granted.
bacula関連のMySQLコマンド群
データベースの作成・削除、テーブルの作成・削除など・・・
/usr/libexec/bacula/create_bacula_database.mysql
/usr/libexec/bacula/create_mysql_database
/usr/libexec/bacula/drop_bacula_database.mysql
/usr/libexec/bacula/drop_bacula_tables.mysql
/usr/libexec/bacula/drop_mysql_database
/usr/libexec/bacula/drop_mysql_tables
/usr/libexec/bacula/grant_bacula_privileges.mysql
/usr/libexec/bacula/grant_mysql_privileges
/usr/libexec/bacula/make_bacula_tables.mysql
/usr/libexec/bacula/make_catalog_backup.mysql
/usr/libexec/bacula/make_mysql_tables
/usr/libexec/bacula/update_bacula_tables.mysql
/usr/libexec/bacula/update_mysql_tables
/usr/sbin/bacula-dir.mysql
/usr/sbin/dbcheck.mysql

Directorデーモンの設定

Directorデーモンに接続するためのパスワードを指定
# vi /etc/bacula/bacula-dir.conf
Director {                            # define myself
Name = bacula-dir
DIRport = 9101                # where we listen for UA connections
QueryFile = "/etc/bacula/query.sql"
WorkingDirectory = "/var/spool/bacula"
PidDirectory = "/var/run"
Maximum Concurrent Jobs = 1
Password = "bacula"         # Console password
Messages = Daemon
}
取得するバックアップ対象を指定(とりあえず全部?で指定してみる)
# List of files to be backed up
FileSet {
Name = "Full Set"
Include {
Options {
signature = MD5
}
#
#  Put your list of files here, preceded by 'File =', one per line
#    or include an external list with:
#
#    File = 
クライアントの設定
# Client (File Services) to backup
Client {
Name = bacula-fd
Address = client.example.com ←バックアップを取得するクライアントのIPアドレスかホスト名を指定
FDPort = 9102
Catalog = MyCatalog
Password = "bacula"                 # password for FileDaemon ←クライアントのFileデーモンのパスワードを指定
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 = storage.example.com        # N.B. Use a fully qualified name here ←ストレージのIPアドレス、ホスト名を指定
SDPort = 9103
Password = "bacula"                  ←バックアップを保存するStorageデーモンのパスワードを指定
Device = FileStorage
Media Type = File
}
次の項目はtray-monitorというプログラムを使用する場合に使いますが、今回は使用しないのでコメントアウト。(最終行辺り)
#Console {
# Name = bacula-mon
# Password = "@@MON_DIR_PASSWORD@@"
# CommandACL = status, .status
#}

Storageデーモンの設定

# vi /etc/bacula/bacula-sd.conf
#
# List Directors who are permitted to contact Storage daemon
#
Director {
Name = bacula-dir              ←接続を許可するDirecotorデーモンを指定。bacula-dir.confで指定したDirector名を指定
Password = "bacula"            ←Storageデーモンに接続するためのパスワードを指定
}
bacula-dir.confと同様にtray-monitorを使用しないので、次の箇所をコメントアウトします。
#
# Restricted Director, used by tray-monitor to get the
#   status of the storage daemon
#
#Director {
#  Name = bacula-mon
#  Password = "@@MON_SD_PASSWORD@@"
#  Monitor = yes
#}
例:ローカルのハードディスクにバックアップを取得する場合のディレクトリ指定。
#
# 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 = /var/backup
LabelMedia = yes;                   # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes;               # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
}
バックアップ先ディレクトリの作成
# mkdir /var/backup
Directorデーモンの起動
# /etc/rc.d/init.d/bacula-dir start
Starting bacula-dir:                                       [  OK  ]
Storageデーモンの起動
# /etc/rc.d/init.d/bacula-sd start
Starting bacula-sd:                                        [  OK  ]
プロセスの確認(Director・Storageデーモンが起動していることを確認)
# ps aux
・
・
root      9917  0.0  0.3 141652  1676 ?        Ssl  14:31   0:00 bacula-dir -c /etc/bacula/bacula-dir.conf
root      9934  0.0  0.2 137572  1284 ?        Ssl  14:31   0:00 bacula-sd -c /etc/bacula/bacula-sd.conf
・
・

Fileデーモンの設定

例:Baculaをインストールしたローカルサーバのバックアップを実施するためのFileデーモン設定。
#
# List Directors who are permitted to contact this File daemon
#
Director {
Name = bacula-dir  ←接続を許可するDirecotor名を指定。
Password = "bacula" ←Storageデーモンに接続するためのパスワードを指定
}
}
tray-monitorを使用しないので下記の記述を削除。※コメントアウトをしただけでは起動に失敗してしまうとのこと
#
# Restricted Director, used by tray-monitor to get the
#   status of the file daemon
#
Director {
Name = bacula-mon
Password = "@@MON_FD_PASSWORD@@"
Monitor = yes
}
Fileデーモンの起動
# /etc/rc.d/init.d/bacula-fd start
Starting bacula-fd:                                        [  OK  ]
プロセスの確認(Fileデーモンが起動していることを確認)
# ps aux
・
・
root     10105  0.0  0.2 127204  1140 ?        Ssl  14:41   0:00 bacula-fd -c /etc/bacula/bacula-fd.conf
・
・

bconsoleの設定

ConsoleからDirectorデーモンへ接続。Consoleの起動はbconsoleで実行。
Consoleで接続する前にbconsoleにDirectorデーモンの設定を行う必要があるとのこと。
# vi /etc/bacula/bconsole.conf
#
# Bacula User Agent (or Console) Configuration File
#
Director {
Name = bacula-dir
DIRport = 9101
address = server.example.com     ←接続するDirectorデーモンのIPアドレスかホスト名を指定
Password = "bacula"              ←Directorデーモンに接続するためのパスワードを指定
}
}
長文になってしまったのでバックアップの実施は次回以降にしたいと思います・・・。

広告

ブログの維持費に充てるでございます・・・。