Bacula网络备份环境搭建

来源:互联网 发布:ubuntu 安装打印机 编辑:程序博客网 时间:2024/04/30 03:01

    最近在学习《企业级服务器导论》这门课,老师在讲备份的内容的时候,留了一个大作业:让自己搭建一个bacula备份环境,要求FD端要和其他的服务端(director、sd端)等分开。
    也许是临近放假,或者是对这个不感兴趣,就是不想做啊,看来离大牛还是有一段距离啊。
    然后就是在网上找教程了,让人心烦的是不同的教程里讲的内容要么是有的矛盾,要么是配置文件格式乱的根本看不下去,有的教程里竟然还少了客户端的配置,不知道写教程的人是当时是怎么运行起来的!!!!对于有矛盾的地方,只能使用笨方法一个个试了,不过最后还是弄出来了。在此做个记录,防止忘记。

  1. 这里参考的一些教程会在最后的参考文献中列出,如果作者认为侵权(教程也可能是别的网站二次转载,这无法控制)可以留言,会删除。
  2. 这里只讨论如何搭建环境,bacula的介绍啥的google吧。
  3. 这里搭建的环境是:Director端、SD端在同一台机器上,FD端在另一台机器上(所以Director端无法备份自己,如果要备份自己的数据,要先修改bacula-fd.conf,修改方法同FD端)。

1. 准备前提环境

在做安装之前确认要对该机器拥有root权限,并且确认你安装好的系统上已经安装如下软件包再继续:

  • Mysql(数据库使用Mysql,也可食用其它数据库)
  • GCC编译器

没有的话需要先安装:

#这里使用yum命令完成安装。[root@server ~]# rpm -qa gcc gcc-c++ mysql mysql-devel mysql-server    #验证一下[root@server ~]# yum install gcc gcc-c++   #安装gcc gcc-c++[root@server ~]# yum install mysql mysql-devel mysql-server       #安装mysql 

2. Bacula安装

:此部分包含FD端的安装与服务器端的安装两个部分。

1. 下载源程序包

[chenyi@server ~]$ su   #切换为root用户#建立存储下载文件的目录。[root@server ~]# mkdir /opt/bacula[root@server ~]# cd /opt/bacula[root@server bacula]# wget http://....

2. 编译并安装Bacula

#*为版本号,这里省略[root@server bacula]# tar zxf bacula-*.tar.gz[root@server bacula]# cd bacula-*#设置环境变量,将$HOME设置为/usr/local[root@server bacula-*]# HOME=/usr/local/[root@server bacula-*]# CFLAGS="-g -Wall"

运行Bacula配置脚本,configure参数详细的说明可查看官方文档。


服务器端与FD端分别设置为如下:

#服务器端

#服务器端[root@server bacula-*]# ./configure \ --sbindir=$HOME/bacula/bin \ --sysconfdir=$HOME/bacula/bin \ --enable-smartalloc \ --enable-tray-monitor \ --with-mysql \ --with-working-dir=$HOME/bacula/bin/working \ --with-pid-dir=$HOME/bacula/bin/working \ --with-subsys-dir=$HOME/bacula/bin/working \ --enable-conio

#FD端

#FD端[root@server bacula-*]# ./configure \--enable-client-only \--sbindir=$HOME/bacula/bin \--sysconfdir=$HOME/bacula/bin \--enable-smartalloc \--with-working-dir=$HOME/bacula/bin/working \--with-pid-dir=$HOME/bacula/bin/working \--with-subsys-dir=$HOME/bacula/bin/working

然后执行下列命令:

[root@server bacula-*]# make[root@server bacula-*]# make install[root@server bacula-*]# make install-autostart     #添加自动启动[root@server bacula-*]# ls /etc/rc.d/init.d/ | grep bacula     #查看是否成功

服务器端显示如下说明成功:

bacula-dir
bacula-fd
bacula-sd

FD端显示如下说明成功:

bacula-fd

FD端的安装到此已经完成,服务器端的还需要进行下面的步骤。

3. 建立Bacula用的数据库

# 启动MySQL并添加至随系统自动启动[root@server bacula-*]# service mysqld start[root@server bacula-*]# chkconfig --level 2345 mysqld on# 进入Bacula可执行文件目录并建立数据库Bacula用户权限[root@server bacula-*]# cd src/cats/[root@server cats]# ./grant_mysql_privileges -pEnter password: 

这里密码设为空,直接按enter键即可,结果类似下面:

Host User Password Select_priv Insert_priv Update_priv Delete_priv 省略后面一部分
localhost root Y Y Y Y Y Y Y 0
chenyi root Y Y Y Y Y Y Y Y 0
127.0.0.1 root Y Y Y Y Y Y Y 0
localhost N N N N N N N 0
chenyi N N N N N N N N 0
localhost bacula N N N N N N N 0
% bacula N N N N N N N N 0
Privileges for user bacula granted on database bacula.

然后执行下列命令:

#建立Bacula 数据库,这里密码设为空,直接按enter键即可[root@bacula cats]# ./create_mysql_database -pEnter password:Creation of bacula database succeeded.#建立Bacula使用的表,这里密码设为空,直接按enter键即可[root@bacula cats]# ./make_mysql_tables -pEnter password:Creation of Bacula MySQL tables succeeded.

到此,Bacula服务器端与FD端就安装完成了,还需要对Bacula进行配置。

3. Bacula服务端配置

重要重要重要重要


作为存储服务器兼控制台,现在需要依次对bconsole.conf(控制台)、bacula-dir.conf(全局)和bacula-sd.conf(存储)配置文件进行修改。

1. 配置console端

cd /usr/local/bacula/binvim bconsole.conf
Director {    Name = server-dir  #控制端名称,在bacula-dir.conf和bacula-sd.conf文件中的director段都会被用到    DIRport =9101    address = server  #可以写IP地址,也可以写hostname,不过如果写hostname的话,要在hosts文件中添加相应的项目    Password ="kl1h6gcOxkzFAWFUb1bl7bvtyiwW702QsypPHPgcuTdK"   #控制端密码文件与bacula-dir中的director中的password要相同 }

2. 配置Director端

在bacula-dir.conf中共有10个逻辑段:

  1. Director 定义全局设置
  2. Jobdefs 定义执行任务的一些共同属性,可以让任务继承,如果有冲突则以job中的为准。
  3. job 自定义一个备份或恢复的任务
  4. Fileset 定义备份哪些数据,不备份哪些数据
  5. Sehedule 定义备份时间策略
  6. Client 定义需要被备份的主机地址,也就是客户端地址
  7. Storage 定义数据的存储方式
  8. Catalog 定义后台数据库
  9. Message 定义发送日志报告和记录日志的位置
  10. Pool 定义供job使用的池属性 下面是一个已经配置好的文件

:标识着“#自动生成”的表示是安装好之后已经存在的且没有修改(password字段除外,因为要保持bacula-dir.conf与bacula-sd.conf里有些密码一致),标识着“#自定义”的表示添加的或修改过。

#自动生成Director {  #定义Bacula的全局配置           Name = server-dir    DIRport = 9101    QueryFile = "/usr/local//bacula/bin/query.sql"    WorkingDirectory = "/usr/local//bacula/bin/working"    PidDirectory = "/usr/local//bacula/bin/working"    Maximum Concurrent Jobs = 1   #定义一次能处理的最大并发数    Password = "kl1h6gcOxkzFAWFUb1bl7bvtyiwW702QsypPHPgcuTdK" # Console password 控制密码,这个密码必须与bconsole.conf文件中对应的Director逻辑段密码相同    Messages = Daemon  #定义日志输出方式,“Daemon”在下面的Messages逻辑段中进行了定义}#自动生成JobDefs {  #定义执行任务的一些默认属性,后面定义的job可以继承,但是如果有冲突以job中为准    Name = "DefaultJob"    Type = Backup    Level = Incremental    Client = server-fd    FileSet = "Full Set"    Schedule = "WeeklyCycle"    Storage = File      Messages = Standard    Pool = File      Priority = 10    Write Bootstrap = "/usr/local//bacula/bin/working/%c.bsr"}#自动生成Job {  #定义一个名为backupclient1的增量备份的任务,defaultJob中定义的是incremental  Name = "BackupClient1"  JobDefs = "DefaultJob"}#自动生成#Job {  #这个任务是新增的,不同的是级别为差异备份。  #Name = "BackupClient2"  #Client = server2-fd  #JobDefs = "DefaultJob"  #Level = Differential#}#自动生成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 <catalog-name>  RunBeforeJob = "/usr/local/bacula/etc/make_catalog_backup.pl MyCatalog"  # This deletes the copy of the catalog  RunAfterJob  = "/usr/local/bacula/etc/delete_catalog_backup"  Write Bootstrap = "/usr/local/bacula/opt/bacula/working/%n.bsr"  Priority = 11       # run after main backup}#自动生成Job {  #定义一个还原任务  Name = "RestoreFiles"  Type = Restore  Client=server-fd                   FileSet="Full Set"  Storage = File                        Pool = Default  Messages = Standard  Where = /tmp/bacula-restores #指定默认恢复数据到这个路径}#自定义Job {  #自定义一个备份任务,可以有多个    Name = "FullBackup"   #备份任务名称,随便写    Client = client_fd   #指定要备份的客户端主机,client_fd在后面Client逻辑段中进行定义    Level = Full   #定义备份的级别,Incremental为增量备份。Level的取值#可为Full(完全备份)、Incremental(增量备份)和Differential(差异备份),如果第一#次没做完全备份,则先进>行完全备份后再执行Incremental    Type = Backup #定义Job的类型,“backup”为备份任务,可选的类型还有restore和verify等    FileSet = "Full Set"  #指定要备份的客户端数据,在后面FileSet逻辑段中进行定义    Schedule = "WeeklyCycle" #指定这个备份任务的执行时间策略,在后面的Schedule逻辑段中行了定义    Storage = File   #指定备份数据的存储路径与介质,在后面的Storage逻辑段中进行定    Messages = Standard    Pool = File #指定备份使用的pool属性,在后面的Pool逻辑段中进行定义。    Write Bootstrap = "/usr/local//bacula/working/client_fd.bsr" #指定备份的引导信息路径,可以自定义}#自动生成FileSet {  #定义一个名为"Full Set"的备份资源,也就是指定需要备份哪些数据,需要排除哪些数据等,可以指定多个FileSet    Name = "Full Set"    Include {        Options {            signature = MD5;  #表示使用MD5签名        }         File = "/usr/local//bacula/bin" #指定客户端FD需要备份的文件目录    }    Exclude { #通过Exclude排除不需要备份的文件或者目录,可根据具体情况修改        File = /usr/local//bacula/working        File = /tmp        File = /proc        File = /tmp        File = /.journal        File = /.fsck    }}#自定义FileSet {    Name = "Client_epsi"    Include {        Options {            signature = MD5;  #表示使用MD5签名            Compression=GZIP;  #表示使用并压缩        }        File = "/usr/local//bacula/working/epsi"    }    Exclude {        File = /usr/local//bacula/working        File = /tmp        File = /proc        File = /tmp        File = /.journal        File = /.fsck    }}#自动生成Schedule {  #定义一个备份任务调度策略    Name = "WeeklyCycle"    Run = Full 1st sun at 23:05  #第一周的周日晚23:05分进行完全备份    Run = Differential 2nd-5th sun at 23:05  #第2~5周的周日晚23:05进行差异备份    Run = Incremental mon-sat at 23:05  #所有周一至周六晚23:05分进行增量备份}#自动生成Schedule {  #定义一个WeeklyCycleAfterBackup备份策略  Name = "WeeklyCycleAfterBackup"    Run = Full sun-sat at 23:10}#自动生成FileSet {    Name = "Catalog"    Include {        Options {            signature = MD5        }        File = "/usr/local//bacula/bin/working/bacula.sql"    }}#自动生成Client {   #Client用来定义备份哪个客户端FD的数据    Name = server-fd     #Clinet的名称,可以在前面的Job中调用    Address = server  #要备份的客户端FD主机的IP地址,也可以写hostname,不过如果写hostname的话,要在hosts文件中添加相应的项目    FDPort = 9102        #与客户端FD通信的端口    Catalog = MyCatalog   #使用哪个数据库存储信息,“MyCatalog”在后面的MyCatalog逻辑段中进定义    Password = "XqJ0aC66ZHt3REH1sFj6wfnTZGdQSd8oqOv+W9cJ+zkh" #Director端与客户端FD的验证密码,这个值必须与客户端FD配置文件bacula-fd.conf中密码相同    File Retention = 30 days  #指定保存在数据库中的记录多久循环一次,这里是30天,只影响数>据库中的记录不影响备份的文件    Job Retention = 6 months   #指定Job的保持周期,应该大于File Retention指定的值    AutoPrune = yes     #当达到指定的保持周期时,是否自动删除数据库中的记录,yes表示自动清除过期的Job}#自定义Client {    Name = client_fd    Address = client    FDPort = 9102    Catalog = MyCatalog    Password = "XqJ0aC66ZHt3REH1sFj6wfnTZGdQSd8oqOv+W9cJ+zkh2"    File Retention = 30 days    Job Retention = 6 months    AutoPrune = yes}#自动生成Storage {  #Storage用来定义将客户端的数据备份到哪个存储设备上    Name = File    Address = server  #指定存储端SD的IP地址,也可以写hostname,不过如果写hostname的话,要在hosts文件中添加相应的项目    SDPort = 9103  #指定存储端SD通信的端口    Password = "U1NXyNwriNYIH7SulVmKp/uGTYiy2C5OY7wnSqkz2voU" #这个值必须与存储端SD(这里是server)的配置文件bacula-sd.conf中Director逻辑段密码相同    Device = FileStorage  #指定数据备份的存储介质,必须与存储端SD(这里是server)的bacula-sd.conf配置文件中的“Device” 逻辑段的“Name”项名称相同    Media Type = File  #指定存储介质的类别,必须与存储端SD(这里是server)的bacula-sd.conf配置文件中的“Device” 逻辑段的“Media Type”项名称相同}#自动生成Catalog {  #Catalog逻辑段用来定义关于日志和数据库设定    Name = MyCatalog    dbname = "bacula"; dbuser = "bacula"; dbpassword = "" #指定库名、用户名和密码}#自动生成Messages {  #Messages逻辑段用来设定Director端如何保存日志,以及日志的保存格式,可以将日志信息发送到管理员邮箱,前提是必须开启sendmail服务    Name = Standard    mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r"    operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: Intervention needed for %j\" %r"    mail = dba.gao@gmail.com = all, !skipped    operator = itchenyi@gmail.com = mount    console = all, !skipped, !saved    append = "/usr/local//bacula/bin/working/log" = all, !skipped #定义bacula的运行日志    append ="/usr/local//bacula/log/bacula.err.log" = error,warning, fatal #定义bacula的错误日志    catalog = all}#自动生成Messages {  #定义了一个名为Daemon的Messages逻辑段,“Daemon”已经在前面进行了引用    Name = Daemon    mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula daemon message\" %r"    mail = exitgogo@126.com = all, !skipped    console = all, !skipped, !saved    append = "/usr/local//bacula/log/bacula_demo.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 = Scratch  Pool Type = Backup}#自动生成Pool {  #定义供Job任务使用的池属性信息,例如,设定备份文件过期时间、是否覆盖过期的备份数据、是否自动清除过期备份等    Name = File    Pool Type = Backup    Recycle = yes  #重复使用    AutoPrune = yes  #表示自动清除过期备份文件    Volume Retention = 365 days  #指定备份文件保留的时间    Maximum Volume Bytes = 50G  # Limit Volume size     Maximum Volumes = 100  #设置最多保存多少个备份文件    #Label Format ="db-${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}-id${JobId}"  #设定备份文件的命名格式,这个设定格式会产生的命名文件为:db-2013-01-27-xxx    #Recycle Current Volume = yes  #表示可以使用最近过期的备份文件来存储新备份    #Maximum Volume Jobs = 1  #表示每次执行备份任务创建一个备份文件}#自动生成Console {  #限定Console利用tray-monitor获得Director的状态信息    Name = server-mon    Password = "/I9QK/9tvB63eOHT2TGJuO7KMzOkrNGi8UtOMGq9LHga"    CommandACL = status, .status}

3. 配置SD端

SD端可以是一台单独的服务器,在此让其跟Director在一台机器上。

#自动生成Storage {  # definition of myself  Name = server-sd     SDPort = 9103  # Director's port        WorkingDirectory = "/usr/local/bacula/opt/bacula/working"  Pid Directory = "/var/run"  Maximum Concurrent Jobs = 20}#自动生成Director {  Name = server-dir   #这里的“Name”值必须和Director端配置文件bacula-dironf中Director逻辑段名称相同 Password = "U1NXyNwriNYIH7SulVmKp/uGTYiy2C5OY7wnSqkz2voU"  #这里的“Password”值须和Director端配置文件bacula-dir.conf中Storage逻辑段密码相同}#自动生成Director {  Name = server-mon  #这里的“Name”值必须和Director端配置文件bacula-diconf中Console逻辑段名称相同  Password = "/I9QK/9tvB63eOHT2TGJuO7KMzOkrNGi8UtOMGq9LHga"  #这里的“Password”值必和Director端配置文件bacula-dir.conf中Console逻辑段密码相同  Monitor = yes}#自动生成Device {  Name = FileStorage  #定义device,与bacula-dir.conf中storage段的device需要相同  Media Type = File  Archive Device = /tmp  #备份的数据存储的路径  LabelMedia = yes;  #通过label命令来建立卷文件  Random Access = Yes;  AutomaticMount = yes;  #when device opened, read it  RemovableMedia = no;  AlwaysOpen = no;}#自动生成Messages {  Name = Standard  director = server-dir = all}

4. Bacula FD端配置

吐槽吐槽吐槽吐槽:有的教程里客户端竟然少了bconsole.conf的配置,这让看教程的人情何以堪!!!!

1. 配置bacula-fd.conf

Director {  #定义一个允许连接FD的控制端    Name = server-dir  #这里的“Name”值必须和Director端配置文件bacula-dir.conf中Director逻辑段名称相同    Password = "XqJ0aC66ZHt3REH1sFj6wfnTZGdQSd8oqOv+W9cJ+zkh2"  #这里的“Password”值必须和Director端配置文件bacula-dir.conf中Client逻辑段密码相同}Director {  #定义一个允许连接FD的监控端    Name = server-mon #与bacula-dir.conf中的console中name需要相同    Password = "/I9QK/9tvB63eOHT2TGJuO7KMzOkrNGi8UtOMGq9LHga" #与bacula-dir.conf中的console中密码一样    Monitor = yes}FileDaemon {  #定义一个允许连接FD的监控端    Name = client-fd    FDport = 9102  #监控端口    WorkingDirectory = /usr/local/bacula/var/bacula/working    Pid Directory = /var/run    Maximum Concurrent Jobs = 20  #定义一次能处理的并发作业数}Messages {  #定义一个用于FD端的Messages    Name = Standard    director = client = all, !skipped, !restored}

2. 配置bconsole.conf

Director {  Name = server-dir  DIRport = 9101  address = server  #服务器位置,可以写IP地址,也可以写hostname,不过如果写hostname的话,要在hosts文件中添加相应的项目  Password = "ConsolePassword"  #与bacula-dir.conf中director中一致}

5. 运行与测试

服务器端启动Bacula进程:

[root@server bin]# ./bacula startStarting the Bacula Storage daemonStarting the Bacula File daemonStarting the Bacula Director daemon

关键的一步,添加存储介质:

[root@server bin]# ./bconsoleConnecting to Director server:91011000 OK: server-dir Version: 5.2.6 (21 February 2012)Enter a period to cancel a command.*label  #创建新的卷来存储备份Automatically selected Catalog: MyCatalogUsing Catalog "MyCatalog"Automatically selected Storage: FileEnter new Volume name: backup  #新建的卷的名称Defined Pools:1: Default2: File3: ScratchSelect the Pool (1-3): 1  #选择PoolConnecting to Storage daemon File at server:9103 ...Sending label command for Volume "backup" Slot 0 ...3000 OK label. VolBytes=193 DVD=0 Volume="backup" Device="FileStorage" (/tmp/backup)Catalog record for Volume "backup", Slot 0  successfully created.Requesting to mount FileStorage ...3906 File device ""FileStorage" (/tmp/backup)" is always mounted.*exit  #退出

这样服务器端就运行起来了,接下来的操作都在FD端进行。
FD端运行:

[root@client bin]# ./bacula start  #启动进程Starting the Bacula File daemon[root@client bin]# ./bconsole  #开始备份Connecting to Director server:91011000 OK: server-dir Version: 5.2.6 (21 February 2012)Enter a period to cancel a command.*run  #开始备份Automatically selected Catalog: MyCatalogUsing Catalog "MyCatalog"A job name must be specified.The defined Job resources are:1: BackupClient12: BackupCatalog3: RestoreFiles4: FullBackupSelect Job resource (1-4): 4  #选择要执行的jobRun Backup jobJobName:  FullBackupLevel:    FullClient:   client_fd FileSet:  Full SetPool:     File (From Job resource)Storage:  File (From Job resource)When:     2013-01-27 19:20:41Priority: 10OK to run? (yes/mod/no): yes  #开始执行备份jobJob queued. JobId=14*status  #查看job状态Status available for:1: Director2: Storage3: Client4: AllSelect daemon type for status (1-4): 3  #选择查看哪一端的状态The defined Client resources are:1: server-fd2: client-fdSelect Client (File daemon) resource (1-2): 2  #选择客户端Connecting to Client client-fd at client-fd:9102client-fd Version: 5.2.6 (21 February 2012)  i686-pc-linux-gnu redhatDaemon started 27- 1013 19:14. Jobs: run=1 running=0.Heap: heap=0 smbytes=90,848 max_bytes=171,749 bufs=60 max_bufs=109Sizeof: boffset_t=8 size_t=4 debug=0 trace=0Running Jobs:Director connected at: 27- 1013 19:20No Jobs running.====Terminated Jobs: JobId  Level    Files      Bytes   Status   Finished        Name ======================================================================    14  Full         29    19.20 M  OK       27- 1013 19:20 FullBackup====You have messages.*exit

此时ls 查看之前定义的备份路径

[root@server bin]# ls -lh /tmp/backup/-rw-r-----. 1 root root 193 126 10:08 backup-rw-r-----. 1 root root 19M 127 19:20 db-2013-01-27-id14  #总用量19M

接下来开始尝试还原,首先删除Client上/usr/local//bacula/working/中的epsi文件夹。然后执行如下命令来还原数据:

[root@client bin]# ./bconsoleConnecting to Director server:91011000 OK: server-dir Version: 5.2.6 (21 February 2012)Enter a period to cancel a command.*restoreAutomatically selected Catalog: MyCatalogUsing Catalog "MyCatalog"First you select one or more JobIds that contain filesto be restored. You will be presented several methodsof specifying the JobIds. Then you will be allowed toselect which files from those JobIds are to be restored.To select the JobIds, you have the following choices:1: List last 20 Jobs run2: List Jobs where a given File is saved3: Enter list of comma separated JobIds to select4: Enter SQL list command5: Select the most recent backup for a client6: Select backup for a client before a specified time7: Enter a list of files to restore8: Enter a list of files to restore before a specified time9: Find the JobIds of the most recent backup for a client10: Find the JobIds for a backup for a client before a specified time11: Enter a list of directories to restore for found JobIds12: Select full restore to a specified Job date13: CancelSelect item:  (1-13): 5Defined Clients:1: server-fd2: client-fdSelect the Client (1-2): 2Automatically selected FileSet: dbfs+-------+-------+----------+------------+---------------------+--------------------+| JobId | Level | JobFiles | JobBytes   | StartTime           | VolumeName         |+-------+-------+----------+------------+---------------------+--------------------+|    14 | F     |       29 | 19,207,422 | 2013-01-27 19:20:46 | db-2013-01-27-id14 |+-------+-------+----------+------------+---------------------+--------------------+You have selected the following JobId: 14Building directory tree for JobId(s) 14 ...24 files inserted into the tree.You are now entering file selection mode where you add (mark) andremove (unmark) files to be restored. No files are initially added, unlessyou used the "all" keyword on the command line.Enter "done" to leave this mode.cwd is: /$ mark *  #“*”表示还原所有的备份文件,可以指定只还原某一文件,具体命令自己google一下吧29 files marked.$ doneBootstrap records written to /usr/local//bacula/bin/working/server-dir.restore.1.bsrThe job will require the followingVolume(s)                 Storage(s)                SD Device(s)===========================================================================db-2013-01-27-id14        dbsd                      FileStorageVolumes marked with "*" are online.29 files selected to be restored.Run Restore jobJobName:         RestoreFilesBootstrap:       /usr/local//bacula/bin/working/server-dir.restore.1.bsrWhere:           /tmp/bacula-restoresReplace:         alwaysFileSet:         Full SetBackup Client:   client-fdRestore Client:  client-fdStorage:         File When:            2013-01-27 19:31:28Catalog:         MyCatalogPriority:        10Plugin Options:  *None*OK to run? (yes/mod/no): mod  #这个地方注意一下,如果要还原到client原位置则按以下步骤Parameters to modify:1: Level2: Storage3: Job4: FileSet5: Restore Client6: When7: Priority8: Bootstrap9: Where10: File Relocation11: Replace12: JobId13: Plugin OptionsSelect parameter to modify (1-13): 9Please enter path prefix for restore (/ for none): /Run Restore jobJobName:         RestoreFilesBootstrap:       /usr/local//bacula/bin/working/chenyi-dir.restore.1.bsrWhere:Replace:         alwaysFileSet:         Full SetBackup Client:   client-fdRestore Client:  client-fdStorage:         FileWhen:            2013-01-27 19:31:28Catalog:         MyCatalogPriority:        10Plugin Options:  *None*OK to run? (yes/mod/no): yesJob queued. JobId=15*exit

现在再看看client,方才删除的文件全部回来了

6. 参考资料

  1. Centos 6.3 部署Bacula实现远程备份还原
  2. Centos 6.3 x86_64安装与配置bacula
  3. Bacula配置
  4. Bacula 安装
  5. 企业级存储备份解决方案系列之一-bacula安装配置篇
  6. Centos 6.3下用Bacula实现远程备份还原
0 0