• 开源备份软件bacula安装记录--包括备份-恢复演练


    该公司原先使用的备用机oracle-linux 5.7 不是很稳定执行。经常死机,新安装centos6.5, 即用bacula要备份的数据。在这里,有关安装故障记录,MEMO.


    操作系统:centos6.5


    1、安装mysql

    用yum安装

    yum install mysql mysql-server mysql-devel

    这里要注意的是一定要安装mysql-devel,否则在等下configure bacula的时候会报找不到mysql.h文件--这里折腾了我好久。差点想去编译安装mysql


    2、安装bacula-server端

    解压

    ./configure --prefix=/opt/bacula --with-mysql                      #这里仅仅要指定mysql就能够,不须要指定路径,由于bacula会去默认的路径去找mysql

    make

    make install


    3、初始化数据库

    初始化的时候要保证mysql的rootpassword为空。。

    进入bacula/etc 文件夹,运行下面命令

    ./grant_mysql_privileges
    ./create_mysql_database
    ./make_mysql_tables 

    4、配置bacula Director端SD端

    这里须要配置一个job  一个fileset 一个client 其它用默认的配置就可以满足一般要求

    以下贴一下我的配置

    Job{                                                          #job的作用是定义一个备份任务。一些參数像差异备份啦 备份周期啦 日志啦等等
      Name="7.17"
      Type = Backup
      Level = Incremental
      Client = 7.17
      FileSet = "7.17"
      Schedule = "WeeklyCycle"
      Storage = File
      Messages = Standard
      Pool = File
      Priority = 10
      Write Bootstrap = "/opt/bacula/var/bacula/working/%c.bsr"
    }
    
    FileSet {                                                    #在fileset里面定义client要备份的文件或者文件夹
      Name = "7.17"
      Include {
        Options {
          signature = MD5
        }
        File = "/opt/jdk"
      }
    
    Client {                                                    #定义client的一些參数,比方ip port 等
      Name = 7.17
      Address = 192.168.7.17
      FDPort = 9102
      Catalog = MyCatalog
      Password = "24H/a2pSWjFxWituyFuB8LpParvcDKgEMywQlxEgxxxx2"          # password for FileDaemon
      File Retention = 30 days            # 30 days
      Job Retention = 6 months            # six months
      AutoPrune = yes                     # Prune expired Jobs/Files
    }
    

    SD端使用默认配置就可以

    5、配置FD端--备份client

    直接上配置。要点就是director的名字和password要和dir的配置对上!


    Director {
      Name = Bacula200-dir
      Password = "24H/a2pSWjFxWituyFuB8LpParvcDKgEMywQlxEgRldd2"
    }
    
    #
    # Restricted Director, used by tray-monitor to get the
    #   status of the file daemon
    #
    Director {
      Name = Bacula200-mon
      Password="24H/a2pSWjFxWituyFuB8LpParvcDKgEMywQlxEgRldd2"
      Monitor = yes
    }
    
    #
    # "Global" File daemon configuration specifications
    #
    FileDaemon {                          # this is me
      Name = centos-003-fd
      FDport = 9102                  # where we listen for the director
      WorkingDirectory = /opt/bacula/var/bacula/working
      Pid Directory = /var/run
      Maximum Concurrent Jobs = 20
    }
    
    # Send all messages except skipped files back to Director
    Messages {
      Name = Standard
      director = centos-003-dir = all, !skipped, !restored
    }
    

    6、開始备份、恢复过程

    备份首先要创建卷组

    在环境变量里面加上 bacula的sbin路径

    PATH=$PATH:$HOME/bin:/opt/bacula/sbin
    然后使用bconsole进入控制台

    然后就能够通过命令控制备份程序了

    首先通过label欻关键卷组

    然后使用run命令開始操作

    备份

    *run                                                             #開始任务使用run选择刚才创建的任务
    Automatically selected Catalog: MyCatalog
    Using Catalog "MyCatalog"
    A job name must be specified.
    The defined Job resources are:
         1: BackupClient1
         2: xxxxxx
         3: xxxxxx
         4: BackupCatalog
         5: RestoreFiles
    Select Job resource (1-5): 1  
    Run Backup job
    JobName:  BackupClient1
    Level:    Incremental
    Client:   Bacula200-fd
    FileSet:  Full Set
    Pool:     File (From Job resource)
    Storage:  File (From Job resource)
    When:     2014-07-07 22:32:21
    Priority: 10
    OK to run?

    (yes/mod/no): yes Job queued. JobId=1 You have messages.


    *s                                                                               #使用s查看director来查看任务运行情况
    Status available for:
         1: Director
         2: Storage
         3: Client
         4: All
    Select daemon type for status (1-4): 1
    Bacula200-dir Version: 5.2.6 (21 February 2012) x86_64-unknown-linux-gnu redhat 
    Daemon started 07-Jul-14 22:22. Jobs: run=1, running=0 mode=0,0
     Heap: heap=274,432 smbytes=81,718 max_bytes=95,201 bufs=292 max_bufs=330
    
    Scheduled Jobs:
    Level          Type     Pri  Scheduled          Name               Volume
    ===================================================================================
    Incremental    Backup    10  07-Jul-14 23:05    BackupClient1      20140708
    Incremental    Backup    10  07-Jul-14 23:05    xxxxx              20140708
    Incremental    Backup    10  07-Jul-14 23:05    xxxxx              20140708
    Full           Backup    11  07-Jul-14 23:10    BackupCatalog      20140708
    ====
    
    Running Jobs:
    Console connected at 07-Jul-14 22:30
    No Jobs running.
    ====
    
    Terminated Jobs:
     JobId  Level    Files      Bytes   Status   Finished        Name 
    ====================================================================
         1  Full         16    10.98 M  OK       07-Jul-14 22:32 BackupClient1


      #任务完毕后,假设你登陆控制台。他会给你发以下备份成功的消息,假设失败也会发消息告诉你原因
      Build OS:               x86_64-unknown-linux-gnu redhat                    
      JobId:                  1
      Job:                    BackupClient1.2014-07-07_22.32.27_03
      Backup Level:           Full (upgraded from Incremental)
      Client:                 "Bacula200-fd" 5.2.6 (21Feb12) x86_64-unknown-linux-gnu,redhat,
      FileSet:                "Full Set" 2014-07-07 22:32:27
      Pool:                   "File" (From Job resource)
      Catalog:                "MyCatalog" (From Client resource)
      Storage:                "File" (From Job resource)
      Scheduled time:         07-Jul-2014 22:32:21
      Start time:             07-Jul-2014 22:32:29
      End time:               07-Jul-2014 22:32:30
      Elapsed time:           1 sec
      Priority:               10
      FD Files Written:       16
      SD Files Written:       16
      FD Bytes Written:       10,988,458 (10.98 MB)
      SD Bytes Written:       10,990,169 (10.99 MB)
      Rate:                   10988.5 KB/s
      Software Compression:   None
      VSS:                    no
      Encryption:             no
      Accurate:               no
      Volume name(s):         20140708
      Volume Session Id:      1
      Volume Session Time:    1404786153
      Last Volume Bytes:      10,999,377 (10.99 MB)
      Non-fatal FD errors:    0
      SD Errors:              0
      FD termination status:  OK
      SD termination status:  OK
      Termination:            Backup OK
    恢复

    *run                                                            #还是使用run開始
    A job name must be specified.
    The defined Job resources are:
         1: BackupClient1
         2: xmygc
         3: xm214
         4: BackupCatalog
         5: RestoreFiles
    Select Job resource (1-5): 5
    Please enter a JobId for restore: 1                            #jobid 能够通过s- dirctory 来查看
    Run Restore job
    JobName:    RestoreFiles
    Bootstrap:  *None*
    Where:      /tmp/bacula-restores
    Replace:         always
    Client:          Bacula200-fd
    Storage:         File
    JobId:           1
    When:            2014-07-08 11:00:35
    Catalog:         MyCatalog
    Priority:        10
    Plugin Options:  *None*
    OK to run?

    (yes/mod/no): mod #能够选择改动恢复的一些參数。这里选择更改恢复目的地 Parameters to modify: 1: Level 2: Storage 3: Job 4: FileSet 5: Restore Client 6: When 7: Priority 8: Bootstrap 9: Where 10: File Relocation 11: Replace 12: JobId 13: Plugin Options Select parameter to modify (1-13): 9 Please enter path prefix for restore (/ for none): /root/test Run Restore job JobName: RestoreFiles Bootstrap: *None* Where: /root/test Replace: always Client: Bacula200-fd Storage: File JobId: 1 When: 2014-07-08 11:00:35 Catalog: MyCatalog Priority: 10 Plugin Options: *None* OK to run?

    (yes/mod/no): yes Job queued. JobId=2


    #报告恢复完毕
    08-Jul 11:11 Bacula200-dir JobId 4: Start Restore Job RestoreFiles.2014-07-08_11.10.59_11
    08-Jul 11:11 Bacula200-dir JobId 4: Using Device "FileStorage"
    08-Jul 11:11 Bacula200-sd JobId 4: Ready to read from volume "20140708" on device "FileStorage" (/home/bak).
    08-Jul 11:11 Bacula200-sd JobId 4: Forward spacing Volume "20140708" to file:block 0:198.
    08-Jul 11:11 Bacula200-sd JobId 4: End of Volume at file 0 on device "FileStorage" (/home/bak), Volume "20140708"
    08-Jul 11:11 Bacula200-sd JobId 4: End of all volumes.
    08-Jul 11:11 Bacula200-dir JobId 4: Bacula Bacula200-dir 5.2.6 (21Feb12):
      Build OS:               x86_64-unknown-linux-gnu redhat 
      JobId:                  4
      Job:                    RestoreFiles.2014-07-08_11.10.59_11
      Restore Client:         Bacula200-fd
      Start time:             08-Jul-2014 11:11:01
      End time:               08-Jul-2014 11:11:01
      Files Expected:         0
      Files Restored:         16
      Bytes Restored:         10,988,458
      Rate:                   0.0 KB/s
      FD Errors:              0
      FD termination status:  OK
      SD termination status:  OK
      Termination:            Restore OK





    版权声明:本文博主原创文章,博客,未经同意不得转载。

  • 相关阅读:
    JQuery优化之 -- 正确使用选择器
    Vue计算属性methords 与 computed 的区别
    HTML中常用字符实体
    SQL复习(w3school)笔记
    AndroidStudio中使用AndroidAnnotations时,build.gradle的配置
    JAVA的第一次作业
    input标签submit属性,用CSS控制样式时高度不好控制的解决办法
    微信小程序开发五:案例实践
    微信小程序开发四:接口
    微信小程序开发三:组件
  • 原文地址:https://www.cnblogs.com/lcchuguo/p/4872771.html
Copyright © 2020-2023  润新知