1. Bacula Server端安装配置
1.1. Bacula Server端安装
1.1.1. 安装bacula依赖包
For Centos6:
yum install -y mysql mysql-server mysql-devel gcc gcc-c++ mysql-devel libacl libacl-devel
For Centos7:
yum install -y mariadb mariadb-server mysql-devel gcc gcc-c++ mysql-devel libacl libacl-devel
1.1.2. 安装bacula服务端
tar zxf bacula-9.x.tar.gz
cd bacula-9.x
CFLAGS="-g -Wall" ./configure \
--sbindir=/usr/local/bacula/bin \
--sysconfdir=/usr/local/bacula/etc \
--with-pid-dir=/usr/local/bacula/working \
--with-subsys-dir=/usr/local/bacula/working \
--with-working-dir=/usr/local/bacula/working \
--enable-smartalloc \
--with-mysql \
--enable-readline \
--with-dump-email=nmonitor@163.com \
--with-job-email=nmonitor@163.com \
--with-smtp-host=mail.163.com
--docdir configure option
# 安装bacula
make && make install && make install-autostart
1.1.3. 创建并授权数据库
For Centos6:
service mysqld start
chkconfig mysqld on
For Centos7:
systemctl start mariadb
systemctl enable mariadb
导入数据库配置(目前不支持MySQL8以上版本)
cd bacula-9.2.2/src/cats
# 赋予权限
./grant_mysql_privileges -p
# 创建数据库
./create_mysql_database -p
# 创建相关表
./make_mysql_tables -p
1.2. Bacula配置及启动
1.2.1. 修改sd address
vi /usr/local/bacula/etc/bacula-dir.conf
# 7.x的为Storage,9.x的为Autochanger
Autochanger {
Name = File1
Address = serverip # N.B. Use a fully qualified name here
# 不能使用localhost,写主机名(可以解析到)或IP地址
Autochanger {
Name = File2
Address = serverip # N.B. Use a fully qualified name here
1.2.2. 修改存储目录(根据实际环境修改)
vi /usr/local/bacula/etc/bacula-sd.conf
# /data 目录为存储备份的目录
Device {
Name = FileChgr1-Dev1
Media Type = File1
Archive Device = /data
LabelMedia = yes; # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
Maximum Concurrent Jobs = 5
}
Device {
Name = FileChgr1-Dev2
Media Type = File1
Archive Device = /data
LabelMedia = yes; # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
Maximum Concurrent Jobs = 5
}
1.2.3. 启动bacula
cd /usr/local/bacula/bin/
# 查看bacula状态
./bacula status
bacula-sd is stopped
bacula-fd is stopped
bacula-dir is stopped
# 启动bacula
./bacula start
Starting the Bacula Storage daemon
Starting the Bacula File daemon
Starting the Bacula Director daemon
bacula日志位于/opt/bacula/log/bacula.log
# 日志路径由bacula-dir.conf配置
# 此配置是在bacula-dir.conf中定义的“append = "/opt/bacula/log/bacula.log" = all, !skipped”
# centos6下只有出现错误时才会产生bacula.log,默认无bacula.log文件。
# centos7下安装完成后会自动生成bacula.log