開源備份軟體bacula安裝記錄--含備份-恢複演練

來源:互聯網
上載者:User

標籤:linux   開源   備份   mysql   

公司原來的備份機器用的是oracle-linux 5.7 啟動並執行不是很穩定,經常出現死機,新裝了一個centos6.5, 準備使用bacula來對資料進行備份,在這裡記錄一下安裝過錯,備忘.


作業系統: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的root密碼為空白。。。。

進入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裡面定義用戶端要備份的檔案或者目錄  Name = "7.17"  Include {    Options {      signature = MD5    }    File = "/opt/jdk"  }Client {                                                    #定義用戶端的一些參數,比如ip 連接埠 等  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端--備份用戶端

直接上配置,要點就是director的名字和密碼要和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 DirectorMessages {  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: MyCatalogUsing Catalog "MyCatalog"A job name must be specified.The defined Job resources are:     1: BackupClient1     2: xxxxxx     3: xxxxxx     4: BackupCatalog     5: RestoreFilesSelect Job resource (1-5): 1  Run Backup jobJobName:  BackupClient1Level:    IncrementalClient:   Bacula200-fdFileSet:  Full SetPool:     File (From Job resource)Storage:  File (From Job resource)When:     2014-07-07 22:32:21Priority: 10OK to run? (yes/mod/no): yesJob queued. JobId=1You have messages.

*s                                                                               #使用s查看director來查看任務執行情況Status available for:     1: Director     2: Storage     3: Client     4: AllSelect daemon type for status (1-4): 1Bacula200-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=330Scheduled Jobs:Level          Type     Pri  Scheduled          Name               Volume===================================================================================Incremental    Backup    10  07-Jul-14 23:05    BackupClient1      20140708Incremental    Backup    10  07-Jul-14 23:05    xxxxx              20140708Incremental    Backup    10  07-Jul-14 23:05    xxxxx              20140708Full           Backup    11  07-Jul-14 23:10    BackupCatalog      20140708====Running Jobs:Console connected at 07-Jul-14 22:30No 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: RestoreFilesSelect Job resource (1-5): 5Please enter a JobId for restore: 1                            #jobid 可以通過s- dirctory 來查看Run Restore jobJobName:    RestoreFilesBootstrap:  *None*Where:      /tmp/bacula-restoresReplace:         alwaysClient:          Bacula200-fdStorage:         FileJobId:           1When:            2014-07-08 11:00:35Catalog:         MyCatalogPriority:        10Plugin 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 OptionsSelect parameter to modify (1-13): 9Please enter path prefix for restore (/ for none): /root/testRun Restore jobJobName:    RestoreFilesBootstrap:  *None*Where:      /root/testReplace:         alwaysClient:          Bacula200-fdStorage:         FileJobId:           1When:            2014-07-08 11:00:35Catalog:         MyCatalogPriority:        10Plugin Options:  *None*OK to run? (yes/mod/no): yesJob queued. JobId=2

#報告恢複完成08-Jul 11:11 Bacula200-dir JobId 4: Start Restore Job RestoreFiles.2014-07-08_11.10.59_1108-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





相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.