分类: 系统运维
2013-07-05 13:37:26
Bacula应用
一、安装
1 下载:www.bacula.org 网站下载linux版 bacula-5.2.6.tar.gz windows bacula-win32-5.2.10.exe
2 linux下安装编译软件GCC 等,数据库软件mysql
3 tar zxvf bacula-5.2.6.tar.gz 进入目录 ./configure --prefix=/opt/bacula --with-mysql
Make make install
4 初始化mysql 执行三个文件
/opt/bacula/etc/grant_mysql_privileges create_mysql_database make_mysql_database
5 客户端安装,不用安装mysql ./configure --prefix=/opt/bacula --enable-client-only
二、配置
1、说明 Bacula 分五个部分,Director Monitor SD Console FD 可以安装在不同的电脑上,也可以安装在一台电脑上,如实际使用最少客户端要分开,可有多个客户端,配置文件在/opt/bacula/etc/下bacula-dir.conf bacula-sd.conf bacula-fd.conf bconsole.conf 如全部安装在同一台电脑上则可以直接使用。
下面是分多台,其中Director Monitor SD Console 在同一台电脑上的设置
注意事项:配置时要注意对应的密码所填的位置,win下的配置一样
2、配置 主文件bacula-dir.conf
bacula-dir.conf:
[root@bak1 etc]# grep '^[^#]' bacula-dir.conf
Director { # define myself
Name = bak1-dir
DIRport = 9101 # where we listen for UA connections
QueryFile = "/opt/bacula/etc/query.sql"
WorkingDirectory = "/opt/bacula/var/bacula/working"
PidDirectory = "/var/run"
Maximum Concurrent Jobs = 1
Password = "UP6skLRuY4PQRnk7/GT1nZ4drUxOwJhQilmORvO7vaTE" # Console password
Messages = Daemon
}
JobDefs {
Name = "DefaultJob"
Type = Backup
Level = Incremental
Client = bak1-fd
FileSet = "Full Set"
Schedule = "WeeklyCycle"
Storage = File
Messages = Standard
Pool = File
Priority = 10
Write Bootstrap = "/opt/bacula/var/bacula/working/%c.bsr"
}
JobDefs {
Name = "chenbak"
Type = Backup
Level = Incremental
Client = bak2-fd
FileSet = "Chenbak"
Schedule = "WeeklyCycle"
Storage = File
Messages = Standard
Pool = File
Priority = 10
Write Bootstrap = "/opt/bacula/var/bacula/working/%c.bsr"
}
Job {
Name = "BackupClient1"
JobDefs = "DefaultJob"
}
Job {
Name = "BackupClient2"
Client = bak2-fd
JobDefs = "chenbak"
}
Job {
Name = "BackupCatalog"
JobDefs = "DefaultJob"
Level = Full
FileSet="Catalog"
Schedule = "WeeklyCycleAfterBackup"
# This creates an ASCII copy of the catalog
# Arguments to make_catalog_backup.pl are:
# make_catalog_backup.pl
RunBeforeJob = "/opt/bacula/etc/make_catalog_backup.pl MyCatalog"
# This deletes the copy of the catalog
RunAfterJob = "/opt/bacula/etc/delete_catalog_backup"
Write Bootstrap = "/opt/bacula/var/bacula/working/%n.bsr"
Priority = 11 # run after main backup
}
Job {
Name = "RestoreFiles"
Type = Restore
Client=bak1-fd
FileSet="Full Set"
Storage = File
Pool = Default
Messages = Standard
Where = /tmp/bacula-restores
}
FileSet {
Name = "Full Set"
Include {
Options {
signature = MD5
}
File = /opt/bacula/sbin
}
Exclude {
File = /opt/bacula/var/bacula/working
File = /tmp
File = /proc
File = /tmp
File = /.journal
File = /.fsck
}
}
Schedule {
Name = "WeeklyCycle"
Run = Full 1st sun at 23:05
Run = Differential 2nd-5th sun at 23:05
Run = Incremental mon-sat at 23:05
}
Schedule {
Name = "WeeklyCycleAfterBackup"
Run = Full sun-sat at 23:10
}
FileSet {
Name = "Catalog"
Include {
Options {
signature = MD5
}
File = "/opt/bacula/var/bacula/working/bacula.sql"
}
}
FileSet {
Name = "Chenbak"
Include {
Options {
signature = MD5
}
File = "/root/html"
}
}
Client {
Name = bak1-fd
Address = bak1
FDPort = 9102
Catalog = MyCatalog
Password = "fC/mwcpD+InL9CEQVQITSuXMtPnn53fDGLEPKvbF62eO" # password for FileDaemon
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
Client {
Name = bak2-fd
Address = 192.168.0.222
FDPort = 9102
Catalog = MyCatalog
Password = "UP6skLRuY4PQRnk7/GT1nZ4drUxOwJhQilmORvO7vaTE1" # password for FileDaemon 2
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
Client {
Name = weh-fd
Address = 192.168.0.209
FDPort = 9102
Catalog = MyCatalog
Password = "B/HefVbaPZPjJDqSJNzk/ocUO5BWMUf/v8GEjjPh7S3x" # password for FileDaemon 2
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}
Storage {
Name = File
Address = bak1 # N.B. Use a fully qualified name here
SDPort = 9103
Password = "MVWiLf+4/yTfyIV6G7eMM9KBV4D+olHboN7Av0b9mPuZ"
Device = FileStorage
Media Type = File
}
Catalog {
Name = MyCatalog
dbname = "bacula"; dbuser = "bacula"; dbpassword = ""
}
Messages {
Name = Standard
mailcommand = "/opt/bacula/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r"
operatorcommand = "/opt/bacula/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: Intervention needed for %j\" %r"
mail = root@localhost = all, !skipped
operator = root@localhost = mount
console = all, !skipped, !saved
append = "/opt/bacula/var/bacula/working/log" = all, !skipped
catalog = all
}
Messages {
Name = Daemon
mailcommand = "/opt/bacula/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula daemon message\" %r"
mail = root@localhost = all, !skipped
console = all, !skipped, !saved
append = "/opt/bacula/var/bacula/working/log" = all, !skipped
}
Pool {
Name = Default
Pool Type = Backup
Recycle = yes # Bacula can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 365 days # one year
}
Pool {
Name = File
Pool Type = Backup
Recycle = yes # Bacula can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 365 days # one year
Maximum Volume Bytes = 50G # Limit Volume size to something reasonable
Maximum Volumes = 100 # Limit number of Volumes in Pool
}
Pool {
Name = Scratch
Pool Type = Backup
}
Console {
Name = bak1-mon
Password = "gklJq6UvdgZZXbmD9zRoNlfGkyDlLefEPE3pyK0UbSVH"
CommandACL = status, .status
}
3、客户端文件
其中一台电脑FD上的配置:bacula-fd.conf
Director {
Name = bak1-dir
Password = "UP6skLRuY4PQRnk7/GT1nZ4drUxOwJhQilmORvO7vaTE1"
}
Director {
Name = bak1-mon
Password = "gklJq6UvdgZZXbmD9zRoNlfGkyDlLefEPE3pyK0UbSVH"
Monitor = yes
}
FileDaemon { # this is me
Name = bak2-fd
FDport = 9102 # where we listen for the director
WorkingDirectory = /opt/bacula/var/bacula/working
Pid Directory = /var/run
Maximum Concurrent Jobs = 20
}
Messages {
Name = Standard
director = bak2-dir = all, !skipped, !restored
}
三、使用
1、启动,先要启动Mysql
./sbin/bacula {start|stop|restart|status}
也可单个服务启动./bacula-fd start
2、查看 netstat -antl |grep 91 看看相应的端口有没有打开
3、使用bconsole进入 可用?查看命令
创建卷组*label
执行备份 *run
查看状态 *status
恢复 *restore
安装时的history
1 ll
2 cd /etc/yum.repos.d/
3 ls
4 vi CentOS-Base.repo
5 ls
6 hostname bacula
7 vi /etc/sysconfig/network
8 vi /etc/hosts
9 reboot
30 yum list
31 yum list |grep mysql
32 yum -y install mysql-server.x86_64 mysql.x86_64 mysql-devel.x86_64
34 service mysqld start
35 mysql
36 ls
37 yum -y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake
40 tar zxvf bacula-5.2.6.tar.gz
42 cd bacula-5.2.6
44 ./configure --prefix=/opt/bacula --with-mysql
45 make
46 make install
49 cd /opt/bacula/
50 cd etc
53 ./grant_mysql_privileges
54 ./create_mysql_database
55 ./make_mysql_tables
58 cd /root/
59 ls
70 tar cvf baculabak.tar /opt/bacula
76 vi bacula-dir.conf
77 ./bacula start
78 ../sbin/bconsole
79 history
80 history > /root/setupbaculahistory