Bacula和webmin管理之网络备份方案
Bacula是一款开源的跨平台网络备份工具,提供基于企业级的CS的备份解决方案。可以对数据进行备份、恢复、以及完整性校验。
功能特点:
支持完全备份Full,增量备份Incremental,差异备份Differential。
支持多种恢复方式
支持多种文件系统下的备份恢复(ext3、ext2、reiserfs、xfs、jfs、smbfs、iso9660、ntfs等)
支持各种备份介质
支持多种操作系统
强大的内部功能,是一个完整的Bacula备份系统。
共有5个部分组成:
1、Director Daemon:负责监听所有的备份、恢复、验证、存档事务,以及定制备份和恢复文件计划等,并将整个系统运行状况记录在一个数据库文件中。其配置文件为bacula-dir.conf。
2、Storage Daemon(SD):主要负责将数据备份到存储介质上,而在数据恢复时,负责将数据从存储介质中传送出去。其配置文件为bacula-sd.conf。
3、File Daemon(FD):安装在需要备份数据的机器上的守护进程,在备份数据时,它负责把文件传出,在恢复数据时负责接收数据并执行恢复操作。配置文件为bacula-fd.conf。
4、Console:管理控制台。可以通过这个控制台连接到Director Daemon进行管理备份与恢复操作。
5、Monitor:进程监控端。
工作流程:
1、通过console连接到Director端,备份恢复操作开始。
2、Director端从自己的数据库中调出记录信息,对存储端SD与客户端FD的任务进行协调。
3、客户端FD负责验证Director的操作许可,如果验证通过,则允许连接到存储端SD
4、客户端FD根据Director发出的请求去连接SD,将FD端的数据备份到存SD指定的存储介质上,或者将SD端存储介质中的数据传回到客户端FD指定的位置上,完成备份恢复过程。
一、bacula提供了三种安装方案
1、Director与SD以及Console在一台机器上,而客户端FD在另外一台或多台机器上。
2、Director与Console在一台机器上,SD在一台机器上,客户端FD在一台或多台上。
3、Director与客户端FD,SD、Console都在一台机器上,也就是服务器自己备份自己,数据保存在本地。
二、配置bacula的Director端
在bacula-dir.conf中共有10个逻辑段:
Director 定义全局设置
Jobdefs 定义执行任务的一些共同属性,可以让任务继承,如果有冲突则以job中的为准。
job 自定义一个备份或恢复的任务
Fileset 定义备份哪些数据,不备份哪些数据
Sehedule 定义备份时间策略
Client 定义需要被备份的主机地址,也就是客户端地址
Storage 定义数据的存储方式
Catalog 定义后台数据库
Message 定义发送日志报告和记录日志的位置
Pool 定义供job使用的池属性
三、Bacula备份系统组成图
四、安装bacula软件
1、项目规划
2、实验功能 (生产环境常见场景)
- bacula-dir和sd安装在同一台服务器上面
- bacula-fd安装在客户端上面(可以配置多台bacula-fd客户端)
3、实验环境
[root@bacula-server bacula]# cat /etc/redhat-release CentOS release 6.6 (Final) [root@bacula-server bacula]# uname -r 2.6.32-504.el6.x86_64
4、检查gcc是否安装 (备注:记得关闭防火墙和selinux)
rpm -qa gcc gcc-c++
5、配置yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo yum clean all yum makecache
6、Install mysql
yum install mysql mysql-server mysql-devel -y /etc/init.d/mysqld restart chkconfig --level 35 mysqld on chkconfig --list mysqld #进入mysql,再退出,看是否正常 [root@bacula-server bacula]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 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> exit Bye
7、安装bacula
[root@bacula-server tools]#cd /home/nulige/tools/ [root@bacula-server tools]# rz -y rz waiting to receive. ???a? zmodem ′???£ °′ Ctrl+C ???£ ??′?? bacula-5.2.13.tar.gz... 100% 4143 KB 4143 KB/s 00:00:01 0 ′? [root@bacula-server tools]# ls bacula-5.2.13.tar.gz
快速安装
tar xf bacula-5.2.13.tar.gz cd bacula-5.2.13 ./configure --with-mysql make && make install echo $?
设置开机自启动
bacula-5.2.13]# make install-autostart (cd platforms && make DESTDIR= install-autostart || exit 1) make[1]: Entering directory `/home/nulige/tools/bacula-7.0.5/platforms' make[2]: Entering directory `/home/nulige/tools/bacula-7.0.5/platforms/redhat' # set symlinks for script at startup and shutdown # set symlinks for script at startup and shutdown # set symlinks for script at startup and shutdown make[2]: Leaving directory `/home/nulige/tools/bacula-7.0.5/platforms/redhat' make[1]: Leaving directory `/home/nulige/tools/bacula-7.0.5/platforms'
8、检查生成的三个文件
[root@bacula-server bacula-5.2.13 ls /etc/init.d/|grep bacula bacula-dir bacula-fd bacula-sd
9、查看安装生成的文件
[root@bacula-server bacula-7.0.5]# cd /etc/bacula/ [root@bacula-server bacula]# ls bacula bconsole.conf drop_bacula_tables make_mysql_tables bacula_config btraceback.dbx drop_mysql_database mtx-changer bacula-ctl-dir btraceback.gdb drop_mysql_tables mtx-changer.conf bacula-ctl-fd btraceback.mdb dvd-handler query.sql bacula-ctl-sd create_bacula_database grant_bacula_privileges update_bacula_tables bacula-dir.conf create_mysql_database grant_mysql_privileges update_mysql_tables bacula-fd.conf delete_catalog_backup make_bacula_tables bacula-sd.conf disk-changer make_catalog_backup bconsole drop_bacula_database make_catalog_backup.pl
10、建立数据库Bacula用户权限
[root@bacula-server bacula]# ./grant_mysql_privileges -p Enter password: 直接回车,因为mysql没有设置密码 Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections localhost root Y Y Y Y Y Y Y Y 0 bacula-server root Y Y Y Y Y Y Y Y 0 127.0.0.1 root Y Y Y Y Y Y Y Y 0 localhost N N N N N N N N 0 bacula-server N N N N N N N N 0 localhost bacula N N N N N N N N 0 % bacula N N N N N N N N N 0 Privileges for user bacula granted on database bacula.
11、执行下列命令,建立Bacula 数据库,这里密码设为空,直接按enter键即可
[root@bacula-server bacula]# ./create_mysql_database -p Enter password: #直接回车,没有密码 Creation of bacula database succeeded.
12、建立Bacula使用的表,这里密码设为空,直接按enter键即可
[root@bacula-server bacula]# ./make_mysql_tables -p Enter password: #直接回车,没有密码 Creation of Bacula MySQL tables succeeded.
13、过滤配置文件(再修改其中参数)
[root@bacula-server-dir bacula]# cat bacula-dir.conf|grep -v ^#|grep -v ^$ [root@bacula-server-dir bacula]# cat bacula-fd.conf|grep -v ^#|grep -v ^$ [root@bacula-server-dir bacula]# cat bacula-sd.conf|grep -v ^#|grep -v ^$
14、先备份配置文件
[root@bacula-server bacula]# mv bacula-dir.conf bacula-dir.conf.bak [root@bacula-server bacula]# mv bacula-fd.conf bacula-fd.conf.bak [root@bacula-server bacula]# mv bacula-sd.conf bacula-sd.conf.bak [root@bacula-server bacula]# ls bacula bacula-sd.conf.bak create_mysql_database dvd-handler mtx-changer bacula_config bconsole delete_catalog_backup grant_bacula_privileges mtx-changer.conf bacula-ctl-dir bconsole.conf disk-changer grant_mysql_privileges query.sql bacula-ctl-fd btraceback.dbx drop_bacula_database make_bacula_tables update_bacula_tables bacula-ctl-sd btraceback.gdb drop_bacula_tables make_catalog_backup update_mysql_tables bacula-dir.conf.bak btraceback.mdb drop_mysql_database make_catalog_backup.p
15、修改配置文件
a、bacula-dir.conf (备注:在服务端上面配置)
[root@bacula-server bacula]# cat bacula-dir.conf
[root@bacula-server bacula]# cat bacula-dir.conf Director { # define myself Name = bacula-server-dir DIRport = 9101 # where we listen for UA connections QueryFile = "/etc/bacula/query.sql" WorkingDirectory = "/opt/bacula/working" PidDirectory = "/var/run" Maximum Concurrent Jobs = 20 Password = "UmfT4FNOZKEqMJfXgmDs5N57TLwjK6k7rD7wrQRszNs3" # Console password Messages = Daemon } JobDefs { Name = "DefaultJob" Type = Backup Level = Incremental Client = bacula-server-fd FileSet = "Full Set" Schedule = "WeeklyCycle" Storage = File1 Messages = Standard Pool = File Priority = 10 Write Bootstrap = "/opt/bacula/working/%c.bsr" } Job { Name = "Backup-192.168.30.130-boot" #修改名称 JobDefs = "DefaultJob" } Job { Name = "Backup-192.168.30.131-home" JobDefs = "DefaultJob" Level = Full RunBeforeJob = "/etc/bacula/make_catalog_backup.pl MyCatalog" RunAfterJob = "/etc/bacula/delete_catalog_backup" Write Bootstrap = "/opt/bacula/working/%n.bsr" Priority = 11 # run after main backup } Job { Name = "RestoreFiles" Type = Restore Client=bacula-server-fd FileSet="Full Set" Storage = File1 Pool = File Messages = Standard Where = /tmp/bacula-restores } FileSet { Name = "Full Set" Include { Options { signature = MD5 } File = "/boot" } Exclude { File = /opt/bacula/working File = /tmp File = /proc File = /tmp File = /sys 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 } Client { Name = bacula-server-fd Address = 192.168.30.130 FDPort = 9102 Catalog = MyCatalog Password = "UmfT4FNOZKEqMJfXgmDs5N57TLwjK6k7rD7wrQRszNs3" # password for FileDaemon File Retention = 30 days # 30 days Job Retention = 6 months # six months AutoPrune = yes # Prune expired Jobs/Files } Storage { Name = File1 Address = 192.168.30.129 # N.B. Use a fully qualified name here SDPort = 9103 Password = "UmfT4FNOZKEqMJfXgmDs5N57TLwjK6k7rD7wrQRszNs3" Device = FileStorage Media Type = File } Catalog { Name = MyCatalog dbname = "bacula"; dbuser = "bacula"; dbpassword = "" } Messages { Name = Standard mailcommand = "/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r" operatorcommand = "/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/log/bacula.log" = all, !skipped catalog = all } Messages { Name = Daemon mailcommand = "/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula daemon message\" %r" mail = root@localhost = all, !skipped console = all, !skipped, !saved append = "/opt/bacula/log/bacula.log" = all, !skipped } 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 } Console { Name = bacula-server-mon Password = "UmfT4FNOZKEqMJfXgmDs5N57TLwjK6k7rD7wrQRszNs3" CommandACL = status, .status }
b、bacula-sd.conf (备注:在服务端上面配置)
[root@bacula-server bacula]# cat bacula-sd.conf
Storage { # definition of myself Name = bacula-server-sd SDPort = 9103 # Director's port WorkingDirectory = "/opt/bacula/working" Pid Directory = "/var/run" Maximum Concurrent Jobs = 20 } Director { Name = bacula-server-dir Password = "UmfT4FNOZKEqMJfXgmDs5N57TLwjK6k7rD7wrQRszNs3" } Director { Name = bacula-server-mon Password = "UmfT4FNOZKEqMJfXgmDs5N57TLwjK6k7rD7wrQRszNs3" Monitor = yes } Device { Name = FileStorage Media Type = File Archive Device = /backup LabelMedia = yes; # lets Bacula label unlabeled media Random Access = Yes; AutomaticMount = yes; # when device opened, read it RemovableMedia = no; AlwaysOpen = no; } Messages { Name = Standard director = bacula-server-dir = all }
#启动服务并检查端口
[root@bacula-server bacula]# /etc/init.d/bacula-dir restart Stopping Bacula Director services: [失败] Starting Bacula Director services: [确定] [root@bacula-server bacula]# /etc/init.d/bacula-sd restart Stopping Bacula Storage services: [失败] Starting Bacula Storage services: [确定] [root@bacula-server bacula]# netstat -antup|grep 91 tcp 0 0 0.0.0.0:9101 0.0.0.0:* LISTEN 38855/bacula-dir tcp 0 0 0.0.0.0:9103 0.0.0.0:* LISTEN 38906/bacula-sd
#创建备份目录
[root@bacula-server ~]# cd / [root@bacula-server /]# mkdir /backup
c、客户端安装方法
1、先更改主机名称
[root@template ~]# hostname bacula-fd [root@template ~]# vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=bacula-fd
#退出再登录
root@template ~]# logout
2、安装bacula-fd客户端
#安装dos2unix (非必须) [root@bacula-fd bacula]# yum install dos2unix -y
#检查yum源 [root@bacula-fd tools]# ll /etc/yum.repos.d/ 总用量 36 -rw-r--r--. 1 root root 2572 5月 15 2015 CentOS-Base.repo -rw-r--r--. 1 root root 1991 7月 24 23:03 CentOS-Base.repo.2017-07-24 -rw-r--r--. 1 root root 2299 7月 24 23:03 CentOS-Base.repoi -rw-r--r--. 1 root root 647 10月 23 2014 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 289 10月 23 2014 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 10月 23 2014 CentOS-Media.repo -rw-r--r--. 1 root root 5394 10月 23 2014 CentOS-Vault.repo -rw-r--r--. 1 root root 1083 5月 15 2015 epel.repo
#创建软件存放目录 [root@bacula-fd ~]# cd /home/nulige/tools/ #上传软件包 [root@bacula-fd tools]# rz -y rz waiting to receive. ???a? zmodem ′???£ °′ Ctrl+C ???£ ??′?? bacula-5.2.13.tar.gz... 100% 4143 KB 4143 KB/s 00:00:01 [root@bacula-fd tools]# ls bacula-5.2.13.tar.gz #快速安装 tar xf bacula-5.2.13.tar.gz cd bacula-5.2.13 ./configure --enable-client-only make && make install echo $? make install-autostart echo $? #进入目录并且备份 cd /etc/bacula/ mv bacula-fd.conf bacula-fd.conf.bak #上传修改好的配置文件 [root@bacula-fd bacula]# rz -y rz waiting to receive. ???a? zmodem ′???£ °′ Ctrl+C ???£ ??′?? bacula-fd.conf... 100% 569 bytes 569 bytes/s 00:00:01 0 ′? [root@bacula-fd bacula]# dos2unix bacula-fd.conf dos2unix: converting file bacula-fd.conf to UNIX format ...
#bacula-fd.conf(备注:在客户端上面配置)
[root@bacula-server bacula]# vi bacula-fd.conf
Director { Name = bacula-server-dir Password = "UmfT4FNOZKEqMJfXgmDs5N57TLwjK6k7rD7wrQRszNs3" } Director { Name = bacula-server-mon Password = "UmfT4FNOZKEqMJfXgmDs5N57TLwjK6k7rD7wrQRszNs3" Monitor = yes } FileDaemon { # this is me Name = bacula-server-fd FDport = 9102 # where we listen for the director WorkingDirectory = /opt/bacula/working Pid Directory = /var/run Maximum Concurrent Jobs = 20 } Messages { Name = Standard director = bacula-server-dir = all, !skipped, !restored }
#启动bacula-fd服务
[root@bacula-fd bacula]# /etc/init.d/bacula-fd restart Stopping Bacula File services: [失败] Starting Bacula File services: [确定]
#查看端口
[root@bacula-fd bacula]# netstat -lntup|grep 91 tcp 0 0 0.0.0.0:9102 0.0.0.0:* LISTEN 10665/bacula-fd
16、修改控制台bconsole.conf的配置文件(备注:在服务端进行修改)
[root@bacula-server bacula]# cd /etc/bacula
vi bconsole.conf
[root@bacula-server bacula]# cat bconsole.conf # # Bacula User Agent (or Console) Configuration File # Director { Name = bacula-server-dir DIRport = 9101 address = 192.168.30.129 #这里填服务端IP地址 Password = "UmfT4FNOZKEqMJfXgmDs5N57TLwjK6k7rD7wrQRszNs3" }
17、运行控制台命令bconsole (备注:在服务端上面操作)
#进行全备
#运行控制台命令(备注:请检查,服务器IP地址和密码,如果错误,无法进入控制台页面。) [root@bacula-server bacula]# bconsole Connecting to Director 192.168.30.129:9101 1000 OK: bacula-server-dir Version: 5.2.13 (19 February 2013) Enter a period to cancel a command. *status #查看状态 Status available for: 1: Director 2: Storage 3: Client 4: All Select daemon type for status (1-4): 1 #选择1 bacula-server-dir Version: 5.2.13 (19 February 2013) x86_64-unknown-linux-gnu redhat Daemon started 26-7月017 23:51. Jobs: run=0, running=0 mode=0,0 Heap: heap=286,720 smbytes=49,952 max_bytes=50,208 bufs=180 max_bufs=185 Scheduled Jobs: Level Type Pri Scheduled Name Volume =================================================================================== Incremental Backup 10 27-7月017 23:05 Backup-192.168.30.130-boot *unknown* Incremental Backup 11 27-7月017 23:05 Backup-192.168.30.131-home *unknown* ==== Running Jobs: Console connected at 26-7月017 23:56 No Jobs running. ==== Terminated Jobs: JobId Level Files Bytes Status Finished Name ==================================================================== 1 Full 0 0 Error 26-7月017 23:05 Backup-192.168.30.130-boot 2 Full 0 0 Error 26-7月017 23:05 Backup-192.168.30.131-home ==== You have messages. * 26-7月 23:05 bacula-server-dir JobId 1: No prior Full backup Job record found. 26-7月 23:05 bacula-server-dir JobId 1: No prior or suitable Full backup found in catalog. Doing FULL backup. 26-7月 23:05 bacula-server-dir JobId 2: No prior Full backup Job record found. 26-7月 23:05 bacula-server-dir JobId 2: No prior or suitable Full backup found in catalog. Doing FULL backup. 26-7月 23:05 bacula-server-dir JobId 1: Start Backup JobId 1, Job=Backup-192.168.30.130-boot.2017-07-26_23.05.00_02 26-7月 23:05 bacula-server-dir JobId 1: Using Device "FileStorage" to write. 26-7月 23:05 bacula-server-dir JobId 1: Fatal error: Unable to authenticate with File daemon at "192.168.30.130:9102". Possible causes: Passwords or names not the same or Maximum Concurrent Jobs exceeded on the FD or FD networking messed up (restart daemon). Please see http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi.html#SECTION00260000000000000000 for help. 26-7月 23:05 bacula-server-dir JobId 1: Warning: Unexpected Client Job message: 2999 Authentication failed. 26-7月 23:05 bacula-server-dir JobId 1: Fatal error: No Job status returned from FD. 26-7月 23:05 bacula-server-dir JobId 1: Error: Bacula bacula-server-dir 5.2.13 (19Jan13): Build OS: x86_64-unknown-linux-gnu redhat JobId: 1 Job: Backup-192.168.30.130-boot.2017-07-26_23.05.00_02 Backup Level: Full (upgraded from Incremental) Client: "bacula-server-fd" FileSet: "Full Set" 2017-07-26 23:05:00 Pool: "File" (From Job resource) Catalog: "MyCatalog" (From Client resource) Storage: "File1" (From Job resource) Scheduled time: 26-7月-2017 23:05:00 Start time: 26-7月-2017 23:05:00 End time: 26-7月-2017 23:05:13 Elapsed time: 13 secs Priority: 10 FD Files Written: 0 SD Files Written: 0 FD Bytes Written: 0 (0 B) SD Bytes Written: 0 (0 B) Rate: 0.0 KB/s Software Compression: None VSS: no Encryption: no Accurate: no Volume name(s): Volume Session Id: 1 Volume Session Time: 1501080551 Last Volume Bytes: 0 (0 B) Non-fatal FD errors: 1 SD Errors: 0 FD termination status: Error SD termination status: Waiting on FD Termination: *** Backup Error *** 26-7月 23:05 bacula-server-dir JobId 2: shell command: run BeforeJob "/etc/bacula/make_catalog_backup.pl MyCatalog" 26-7月 23:05 bacula-server-dir JobId 2: Start Backup JobId 2, Job=Backup-192.168.30.131-home.2017-07-26_23.05.00_03 26-7月 23:05 bacula-server-dir JobId 2: Using Device "FileStorage" to write. 26-7月 23:05 bacula-server-dir JobId 2: Fatal error: Unable to authenticate with File daemon at "192.168.30.130:9102". Possible causes: Passwords or names not the same or Maximum Concurrent Jobs exceeded on the FD or FD networking messed up (restart daemon). Please see http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi.html#SECTION00260000000000000000 for help. 26-7月 23:05 bacula-server-dir JobId 2: Warning: Unexpected Client Job message: 2999 Authentication failed. 26-7月 23:05 bacula-server-dir JobId 2: Fatal error: No Job status returned from FD. 26-7月 23:05 bacula-server-dir JobId 2: Error: Bacula bacula-server-dir 5.2.13 (19Jan13): Build OS: x86_64-unknown-linux-gnu redhat JobId: 2 Job: Backup-192.168.30.131-home.2017-07-26_23.05.00_03 Backup Level: Full (upgraded from Incremental) Client: "bacula-server-fd" FileSet: "Full Set" 2017-07-26 23:05:00 Pool: "File" (From Job resource) Catalog: "MyCatalog" (From Client resource) Storage: "File1" (From Job resource) Scheduled time: 26-7月-2017 23:05:00 Start time: 26-7月-2017 23:05:14 End time: 26-7月-2017 23:05:26 Elapsed time: 12 secs Priority: 11 FD Files Written: 0 SD Files Written: 0 FD Bytes Written: 0 (0 B) SD Bytes Written: 0 (0 B) Rate: 0.0 KB/s Software Compression: None VSS: no Encryption: no Accurate: no Volume name(s): Volume Session Id: 2 Volume Session Time: 1501080551 Last Volume Bytes: 0 (0 B) Non-fatal FD errors: 1 SD Errors: 0 FD termination status: Error SD termination status: Waiting on FD Termination: *** Backup Error *** 26-7月 23:49 bacula-server-dir: ERROR in authenticate.c:415 Unable to authenticate console "*UserAgent*" at client:127.0.0.1:9101. *label #创建label Automatically selected Catalog: MyCatalog Using Catalog "MyCatalog" Automatically selected Storage: File1 Enter new Volume name: backup-2017-7-26 Defined Pools: 1: Default 2: File 3: Scratch Select the Pool (1-3): 2 #选择2 Connecting to Storage daemon File1 at 192.168.30.129:9103 ... Sending label command for Volume "backup-2017-7-26" Slot 0 ... 3000 OK label. VolBytes=215 DVD=0 Volume="backup-2017-7-26" Device="FileStorage" (/backup) Catalog record for Volume "backup-2017-7-26", Slot 0 successfully created. Requesting to mount FileStorage ... 3906 File device ""FileStorage" (/backup)" is always mounted. *status #查看状态 Status available for: 1: Director 2: Storage 3: Client 4: All Select daemon type for status (1-4): 1 #输入1 查看状态 bacula-server-dir Version: 5.2.13 (19 February 2013) x86_64-unknown-linux-gnu redhat Daemon started 26-7月017 23:51. Jobs: run=0, running=0 mode=0,0 Heap: heap=286,720 smbytes=59,509 max_bytes=60,282 bufs=196 max_bufs=203 Scheduled Jobs: Level Type Pri Scheduled Name Volume =================================================================================== Incremental Backup 10 27-7月017 23:05 Backup-192.168.30.130-boot backup-2017-7-26 Incremental Backup 11 27-7月017 23:05 Backup-192.168.30.131-home backup-2017-7-26 ==== Running Jobs: Console connected at 26-7月017 23:56 No Jobs running. ==== Terminated Jobs: JobId Level Files Bytes Status Finished Name ==================================================================== 1 Full 0 0 Error 26-7月017 23:05 Backup-192.168.30.130-boot 2 Full 0 0 Error 26-7月017 23:05 Backup-192.168.30.131-home ==== *run #运行备份命令 A job name must be specified. The defined Job resources are: 1: Backup-192.168.30.130-boot 2: Backup-192.168.30.131-home 3: RestoreFiles Select Job resource (1-3): 1 #选择备份目录 Run Backup job JobName: Backup-192.168.30.130-boot Level: Incremental Client: bacula-server-fd FileSet: Full Set Pool: File (From Job resource) Storage: File1 (From Job resource) When: 2017-07-26 23:59:20 Priority: 10 OK to run? (yes/mod/no): yes #输入yes,确认备份 Job queued. JobId=3 You have messages. *messages #查看详细信息 26-7月 23:59 bacula-server-dir JobId 3: No prior Full backup Job record found. 26-7月 23:59 bacula-server-dir JobId 3: No prior or suitable Full backup found in catalog. Doing FULL backup. 26-7月 23:59 bacula-server-dir JobId 3: Start Backup JobId 3, Job=Backup-192.168.30.130-boot.2017-07-26_23.59.22_03 26-7月 23:59 bacula-server-dir JobId 3: Using Device "FileStorage" to write. 26-7月 23:59 bacula-server-sd JobId 3: Wrote label to prelabeled Volume "backup-2017-7-26" on device "FileStorage" (/backup) 26-7月 23:59 bacula-server-sd JobId 3: Elapsed time=00:00:01, Transfer rate=31.17 M Bytes/second 26-7月 23:59 bacula-server-dir JobId 3: Bacula bacula-server-dir 5.2.13 (19Jan13): Build OS: x86_64-unknown-linux-gnu redhat JobId: 3 Job: Backup-192.168.30.130-boot.2017-07-26_23.59.22_03 Backup Level: Full (upgraded from Incremental) Client: "bacula-server-fd" 5.2.13 (19Jan13) x86_64-unknown-linux-gnu,redhat, FileSet: "Full Set" 2017-07-26 23:05:00 Pool: "File" (From Job resource) Catalog: "MyCatalog" (From Client resource) Storage: "File1" (From Job resource) Scheduled time: 26-7月-2017 23:59:20 Start time: 26-7月-2017 23:59:25 End time: 26-7月-2017 23:59:25 Elapsed time: 0 secs Priority: 10 FD Files Written: 30 SD Files Written: 30 FD Bytes Written: 31,171,739 (31.17 MB) SD Bytes Written: 31,174,745 (31.17 MB) Rate: 0.0 KB/s Software Compression: None VSS: no Encryption: no Accurate: no Volume name(s): backup-2017-7-26 Volume Session Id: 1 Volume Session Time: 1501084324 Last Volume Bytes: 31,199,354 (31.19 MB) Non-fatal FD errors: 0 SD Errors: 0 FD termination status: OK SD termination status: OK Termination: Backup OK 26-7月 23:59 bacula-server-dir JobId 3: Begin pruning Jobs older than 6 months . 26-7月 23:59 bacula-server-dir JobId 3: No Jobs found to prune. 26-7月 23:59 bacula-server-dir JobId 3: Begin pruning Files. 26-7月 23:59 bacula-server-dir JobId 3: No Files found to prune. 26-7月 23:59 bacula-server-dir JobId 3: End auto prune. *stat #查看状态 Status available for: 1: Director 2: Storage 3: Client 4: All Select daemon type for status (1-4): 1 #选择1 bacula-server-dir Version: 5.2.13 (19 February 2013) x86_64-unknown-linux-gnu redhat Daemon started 26-7月017 23:51. Jobs: run=1, running=0 mode=0,0 Heap: heap=286,720 smbytes=88,223 max_bytes=98,330 bufs=239 max_bufs=272 Scheduled Jobs: Level Type Pri Scheduled Name Volume =================================================================================== Incremental Backup 10 27-7月017 23:05 Backup-192.168.30.130-boot backup-2017-7-26 Incremental Backup 11 27-7月017 23:05 Backup-192.168.30.131-home backup-2017-7-26 ==== Running Jobs: Console connected at 26-7月017 23:56 No Jobs running. ==== Terminated Jobs: JobId Level Files Bytes Status Finished Name ==================================================================== 1 Full 0 0 Error 26-7月017 23:05 Backup-192.168.30.130-boot 2 Full 0 0 Error 26-7月017 23:05 Backup-192.168.30.131-home 3 Full 30 31.17 M OK 26-7月017 23:59 Backup-192.168.30.130-boot #全备Full ==== *exit #退出 #查看下备份目录 [root@bacula-server bacula]# cd /backup/ [root@bacula-server backup]# ls backup-2017-7-26 [root@bacula-server backup]# file backup-2017-7-26 backup-2017-7-26: data
#查看备份文件大小
[root@bacula-fd bacula]# du -sh /boot
30M /boot
客户端备份完毕!
#差异备份
五、安装webmin管理界面
软件下载地址http://sourceforge.net/projects/webadmin/files/webmin/
本实验使用webmin-1.690-1.noarch.rpm
[root@bacula-server ~]# cd /home/nulige/tools/ [root@bacula-server tools]# ll 总用量 4164 drwxr-xr-x 11 1000 1000 4096 7月 26 22:41 bacula-5.2.13 -rw-r--r-- 1 root root 4243395 7月 26 22:38 bacula-5.2.13.tar.gz -rw-r--r--. 1 root root 13236 4月 21 2016 system_optimize_scripts.sh
[root@bacula-server tools]# rz -y rz waiting to receive. ???a? zmodem ′???£ °′ Ctrl+C ???£ ??′?? webmin-1.690-1.noarch.rpm... 100% 21728 KB 21728 KB/s 00:00:01 0 ′? ?[root@bacula-server tools]# ls bacula-5.2.13 bacula-5.2.13.tar.gz system_optimize_scripts.sh webmin-1.690-1.noarch.rpm
[root@bacula-server tools]# rpm -ivh webmin-1.690-1.noarch.rpm warning: webmin-1.690-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 11f63c51: NOKEY Preparing... ########################################### [100%] Operating system is CentOS Linux 1:webmin ########################################### [100%] Webmin install complete. You can now login to http://bacula-server:10000/ as root with your root password.
[root@bacula-fd tools]# /etc/init.d/webmin restart
Stopping Webmin server in /usr/libexec/webmin
Starting Webmin server in /usr/libexec/webmin
Pre-loaded WebminCore
[root@bacula-server tools]# chkconfig --level 35 webmin on
打开IE浏览器,输入http:$IP:10000 ,用户名为root,口令即是LINUX系统用户口令
#选择mysql
点保存