bacula-dir | バキュラ全体の管理役。バックアップジョブ管理も行う |
bacula-sd | バキュラのバックアップデータ書き込み先のストレージの管理 |
bacula-fd |
バキュラのバックアップを実際に実行するクライアント
|
//yumでinstall yum -y install bacula-director bacula-client bacula-storage bacula-console mysql-server //install確認 [root@lab-backup01 ~]# rpm -qa | grep bacula bacula-storage-mysql-5.0.0-13.el6.x86_64 bacula-director-common-5.0.0-13.el6.x86_64 bacula-client-5.0.0-13.el6.x86_64 bacula-common-5.0.0-13.el6.x86_64 bacula-storage-common-5.0.0-13.el6.x86_64 bacula-director-mysql-5.0.0-13.el6.x86_64 bacula-console-5.0.0-13.el6.x86_64
[root@lab-backup01 ~]# /etc/init.d/mysqld start [root@lab-backup01 ~]# /usr/bin/mysqladmin -u root password ‘YourPassword' mysql> create database bacula; Query OK, 1 row affected (0.00 sec) mysql> grant all privileges on *.* to bacula@localhost identified by 'YourPassword'; Query OK, 0 rows affected (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | bacula | | mysql | | test | +--------------------+ 4 rows in set (0.00 sec) mysql> quit Bye
テーブルは付属のツールを実行して作成します。下記のShellスクリプトを実行すると必要なテーブルが作成されます。。
/usr/libexec/bacula/make_mysql_tables -u root -p
[root@backup ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 11 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | bacula | | mysql | | test | +--------------------+ 4 rows in set (0.00 sec) mysql> use bacula Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> mysql> mysql> show tables ; +------------------+ | Tables_in_bacula | +------------------+ | BaseFiles | | CDImages | | Client | | Counters | | Device | | File | | FileSet | | Filename | | Job | | JobHisto | | JobMedia | | Location | | LocationLog | | Log | | Media | | MediaType | | Path | | PathHierarchy | | PathVisibility | | Pool | | Status | | Storage | | UnsavedFiles | | Version | +------------------+ 24 rows in set (0.00 sec)
//Config Backup cp -a /etc/bacula/bacula-dir.conf /etc/bacula/bacula-dir.conf.default cp -a /etc/bacula/bacula-sd.conf /etc/bacula/bacula-sd.conf.default cp -a /etc/bacula/bacula-fd.conf /etc/bacula/bacula-fd.conf.default cp -a /etc/bacula/bconsole.conf /etc/bacula/bconsole.conf.default //パスワードの箇所を書き換えます。 sed -i -e "s/@@.*_PASSWORD@@/パスワード/g" /etc/bacula/bacula-dir.conf sed -i -e "s/@@.*_PASSWORD@@/パスワード/g" /etc/bacula/bacula-sd.conf sed -i -e "s/@@.*_PASSWORD@@/パスワード/g" /etc/bacula/bacula-fd.conf sed -i -e "s/@@.*_PASSWORD@@/パスワード/g" /etc/bacula/bconsole.conf
/etc/init.d/bacula-fd start /etc/init.d/bacula-sd start /etc/init.d/bacula-dir start
[root@lab-backup01 ~]# mkdir /etc/bacula/lab-servers.d [root@lab-backup01 ~]# touch /etc/bacula/lab-servers.d/common.conf [root@lab-backup01 ~]# chown root:bacula /etc/bacula/lab-servers.d/common.conf [root@lab-backup01 ~]# chmod 640 /etc/bacula/lab-servers.d/common.conf
vi /etc/bacula/bacula-dir.conf //末尾に追記 #Share config Include @/etc/bacula/lab-servers.d/common.conf
今回は以下のように役割を分けています。
common.conf
|
各サーバで共通設定とするバックアップ設定をまとめて記載。メインコンフィグでインクルード。
|
template.conf
|
新しくバックアップ対象を追加するときにコピーして利用するテンプレ的なファイル。
IPアドレスとホスト名をダミーの値にしておく。(xx.xx.xx.xx, template.com) テンプレート
なのでIncludeはしない。
|
[root@backup ~]# cat /etc/bacula/lab-servers.d/common.conf
Schedule {
Name = "lab-schedule01"
Run = Full mon at 04:05
Run = Incremental tue-sun at 04:05
}
FileSet {
Name = "server all data"
Include {
Options {
signature = MD5
}
File = /
}
Exclude {
File = /var/spool/bacula
File = /tmp
File = /proc
File = /.journal
File = /.fsck
}
}
Storage {
Name = nas_server
Address = 10.24.96.140
SDPort = 9103
Password = “YourPassword"
Device = FileStorage
Media Type = File
}
Pool {
Name = lab_backup_pool
Pool Type = Backup
Recycle = yes
AutoPrune = yes
Volume Retention = 7 days
}
|
Job {
Name = "template.com"
Type = Backup
Level = Full
Client = "template.com"
FileSet = "server all data"
Schedule = "lab-schedule01"
Storage = nas_server
Messages = Standard
Pool = lab_backup_pool
Priority = 10
Write Bootstrap = "/var/spool/bacula/%c.bsr"
}
Job {
Name = "template.com_Restore"
Type = Restore
Client="template.com"
FileSet="server all data"
Storage = nas_server
Pool = lab_backup_pool
Messages = Standard
Where = /nas/bacula/restores
}
Client {
Name = "template.com"
Address = xx.xx.xx.xx
FDPort = 9102
Catalog = MyCatalog
Password = “YourPassword"
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
|
サーバ側と違い設定はごくシンプルです。Bacula-fdデーモンのパスワード設定を変更し、サーバ側から接続できる状態にしてあげるだけです。
クライアントインストールは下記実行。
[root@CentOS6-Base-Template01 ~]# yum install bacula-client
sed -i -e "s/@@.*_PASSWORD@@/パスワード/g" /etc/bacula/bacula-fd.conf
Copyright © 2021 たぐたぐ.com. All rights reserved.