su root cd /etc/bacula/ vi bacula-dir.conf # 242行编辑数据库信息,新创建用户为bacula,密码为空,数据库名为bacula
测试
启动测试
1 2 3 4 5 6 7 8
/etc/bacula/bacula start # Starting the Bacula Storage daemon # Starting the Bacula File daemon # Starting the Bacula Director daemon bacula status # bacula-sd (pid 40493) is running... # bacula-fd (pid 40502) is running... # bacula-dir (pid 40510) is running...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
[root@localhost bacula]# bconsole Connecting to Director localhost:9101 1000 OK: 103 localhost.localdomain-dir Version: 9.4.4 (28 May 2019) Enter a period to cancel a command. *
*status Status available for: 1: Director 2: Storage 3: Client 4: Scheduled 5: Network 6: All Select daemon typefor status (1-6):6
# 新建需要备份的测试目录 mkdir /baculatest echo"test" > /baculatest/test.txt # 修改bacula-dir.conf将Fileset中File = /sbin 改为 File = /baculatest/ 约125行。然后重启 bacula restart bconsole #运行run,选择1 *run Automatically selected Catalog: MyCatalog Using Catalog "MyCatalog" A job name must be specified. The defined Job resources are: 1: BackupClient1 2: BackupCatalog 3: RestoreFiles Select Job resource (1-3): 1 Run Backup job JobName: BackupClient1 Level: Incremental Client: localhost.localdomain-fd FileSet: Full Set Pool: File (From Job resource) Storage: File1 (From Job resource) When: 2019-11-06 08:25:45 Priority: 10 OK to run? (yes/mod/no): yes Job queued. JobId=1 You have messages. # 完成后将有输出 ok # 查看状态status可简写s *s Status available for: 1: Director 2: Storage 3: Client 4: Scheduled 5: Network 6: All Select daemon typefor status (1-6): 1 localhost.localdomain-dir Version: 9.4.4 (28 May 2019) x86_64-pc-linux-gnu redhat (Core) Daemon started 06-Nov-19 08:24, conf reloaded 06-Nov-2019 08:24:52 Jobs: run=2, running=0 mode=0,0 Heap: heap=270,336 smbytes=106,320 max_bytes=132,779 bufs=317 max_bufs=346 Res: njobs=3 nclients=1 nstores=2 npools=3 ncats=1 nfsets=2 nscheds=2
Scheduled Jobs: Level Type Pri Scheduled Job Name Volume =================================================================================== Incremental Backup 10 06-Nov-19 23:05 BackupClient1 Vol-0001 Full Backup 11 06-Nov-19 23:10 BackupCatalog Vol-0001 ====
Running Jobs: Console connected at 06-Nov-19 08:25 No Jobs running. ====
Terminated Jobs: JobId Level Files Bytes Status Finished Name ==================================================================== 1 Full 2 5 OK 06-Nov-19 08:25 BackupClient1 2 Restore 0 0 Error 06-Nov-19 08:37 RestoreFiles
====
# 在控制台将有提示:You have mail in /var/spool/mail/root # 安装mailx并查看邮件 yum install -y mailx [root@localhost baculatest]# mail Heirloom Mail version 12.5 7/5/10. Type ? forhelp. "/var/spool/mail/root": 1 message 1 new >N 1 Bacula Wed Nov 6 08:25 65/3414 "Bacula: Backup OK of " & 1 # 节选,我这里sd报错了 SD Errors: 0 FD termination status: OK SD termination status: OK Termination: Backup OK & exit
删除创建的文件并恢复
1 2 3 4 5 6 7 8 9 10
rm test.txt
*run A job name must be specified. The defined Job resources are: 1: BackupClient1 2: BackupCatalog 3: RestoreFiles Select Job resource (1-3): 3
# baucla版本9.4.4 Director { Name = 客户端名称 Password = "客户端密码" } # # Restricted Director, used by tray-monitor to get the # status of the file daemon # Director { Name = 服务端名称 Password="Monitor密码" Monitor = yes } # # "Global" File daemon configuration specifications # FileDaemon { # this is me Name = 服务端名称 FDport = 9102 # where we listen for the director WorkingDirectory = /opt/bacula/working Pid Directory = /var/run Maximum Concurrent Jobs = 20 Plugin Directory = /usr/lib64 } # Send all messages except skipped files back to Director Messages { Name = Standard director = 服务端名称 = all, !skipped, !restored }