当前位置:首页文章首页 IT学院 IT技术

利用bacula完成数据的备份恢复

作者:  来源:  发布时间:2012-2-16 8:52:38  点击:

 
4.查看备份文件
[root@baculaserver etc]# ls -ls /home/webbak/
总计 12
4 -rw-r----- 1 root root 825 02-15 23:37 db-2012-02-15-id2
4 -rw-r----- 1 root root 969 02-15 23:40 db-2012-02-15-id3   
4 -rw-r----- 1 root root 900 02-15 23:30 webbak               #label产生的卷组文件
 
六、bacula恢复文件
1. 利用差异备份进行完全恢复
[root@balucaclient etc]# rm -rf /var/www/html/*   #删除fd中所有文件
[root@baculaserver etc]# ./bconsole
Connecting to Director 192.168.32.30:9101
1000 OK: 2012-02-15-dir Version: 5.0.1 (24 February 2010)
Enter a period to cancel a command.
*restore
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
 
First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.
 
To select the JobIds, you have the following choices:
     1: List last 20 Jobs run
     2: List Jobs where a given File is saved
     3: Enter list of comma separated JobIds to select
     4: Enter SQL list command
     5: Select the most recent backup for a client
     6: Select backup for a client before a specified time
     7: Enter a list of files to restore
     8: Enter a list of files to restore before a specified time
     9: Find the JobIds of the most recent backup for a client
    10: Find the JobIds for a backup for a client before a specified time
    11: Enter a list of directories to restore for found JobIds
    12: Select full restore to a specified Job date
    13: Cancel
Select item:  (1-13): 3
Enter JobId(s), comma separated, to restore: 1,3
You have selected the following JobIds: 1,3
#从备份状态看,JobID为1的为完全备份,JobID为3的为差异备份,因此只需恢复jobid为1和3的备份即可完全恢复
Building directory tree for JobId(s) 1,3 ... 
3 files inserted into the tree.
 
You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.
 
cwd is: /
$ mark *                    #指定要恢复的文件或目录,* 表所有
5 files marked.
$ done
Storage "" not found, using Storage "dbsd" from MediaType "File".
Bootstrap records written to /usr/local/bacula/var/bacula/working/2012-02-15-dir.restore.1.bsr
 
The job will require the following
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================
  
    webbak                                                                      
    db-2012-02-15-id3                                                           
 
Volumes marked with "*" are online.
 
5 files selected to be restored.
 
Automatically selected Client: 2012-02-15-fd
Run Restore job
JobName:         Restoreweb
Bootstrap:       /usr/local/bacula/var/bacula/working/2012-02-15-dir.restore.1.bsr
Where:           *None*
Replace:         always
FileSet:         dbfs
Backup Client:   2012-02-15-fd
Restore Client:  2012-02-15-fd
Storage:         dbsd
When:            2012-02-15 23:54:12
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=4
 
[root@balucaclient etc]# ls /var/www/html/                     
index1.html  index2.html  index3.html
#查看fd端,显示已经完全恢复
 
2. 利用恢复指定的文件
[root@balucaclient etc]# rm -rf /var/www/html/*
[root@baculaserver etc]# ./bconsole
*restore
First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.
 
To select the JobIds, you have the following choices:
     1: List last 20 Jobs run
     2: List Jobs where a given File is saved
     3: Enter list of comma separated JobIds to select
     4: Enter SQL list command
     5: Select the most recent backup for a client
     6: Select backup for a client before a specified time
     7: Enter a list of files to restore
     8: Enter a list of files to restore before a specified time
     9: Find the JobIds of the most recent backup for a client
    10: Find the JobIds for a backup for a client before a specified time
    11: Enter a list of directories to restore for found JobIds
    12: Select full restore to a specified Job date
    13: Cancel
Select item:  (1-13): 7     #7表示恢复指定的文件
Automatically selected Client: 2012-02-15-fd
Enter file names with paths, or < to enter a filename
containing a list of file names with paths, and terminate
them with a blank line.
Enter full filename: /var/www/html/index2.html     #指定恢复index2.html文件
Enter full filename:
Storage "" not found, using Storage "dbsd" from MediaType "File".
Bootstrap records written to /usr/local/bacula/var/bacula/working/2012-02-15-dir.restore.2.bsr
 
The job will require the following
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================
  
    db-2012-02-15-id3                                                           
 
Volumes marked with "*" are online.
 
 
1 file selected to be restored.
 
Run Restore job
JobName:         Restoreweb
Bootstrap:       /usr/local/bacula/var/bacula/working/2012-02-15-dir.restore.2.bsr
Where:           *None*
Replace:         always
FileSet:         dbfs
Backup Client:   2012-02-15-fd
Restore Client:  2012-02-15-fd
Storage:         dbsd
When:            2012-02-16 00:03:19
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=5
 
[root@balucaclient etc]# ls /var/www/html/    
index2.html
#显示fd上index2.html成功恢复
 
3. 增量备份的完全恢复
[root@balucaclient etc]# rm -rf /var/www/html/*
[root@baculaserver etc]# ./bconsole
Connecting to Director 192.168.32.30:9101
1000 OK: 2012-02-15-dir Version: 5.0.1 (24 February 2010)
Enter a period to cancel a command.
*restore
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
 
First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.
 
To select the JobIds, you have the following choices:
     1: List last 20 Jobs run
     2: List Jobs where a given File is saved
     3: Enter list of comma separated JobIds to select
     4: Enter SQL list command
     5: Select the most recent backup for a client
     6: Select backup for a client before a specified time
     7: Enter a list of files to restore
     8: Enter a list of files to restore before a specified time
     9: Find the JobIds of the most recent backup for a client
    10: Find the JobIds for a backup for a client before a specified time
    11: Enter a list of directories to restore for found JobIds
    12: Select full restore to a specified Job date
    13: Cancel
Select item:  (1-13): 3
Enter JobId(s), comma separated, to restore: 1,2
You have selected the following JobIds: 1,2
#从备份状态看,JobID为1的为完全备份,JobID为2的为第一个增量备份,如果2之前还有其他的增量备份,必须在此指定,才能完全恢复
2 files inserted into the tree.
 
You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.
 
cwd is: /
$ mark *
4 files marked.
$ done
Storage "" not found, using Storage "dbsd" from MediaType "File".
Bootstrap records written to /usr/local/bacula/var/bacula/working/2012-02-15-dir.restore.3.bsr
 
The job will require the following
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================
  
    webbak                                                                      
    db-2012-02-15-id2                                                           
 
Volumes marked with "*" are online.
 
 
4 files selected to be restored.
 
Automatically selected Client: 2012-02-15-fd
Run Restore job
JobName:         Restoreweb
Bootstrap:       /usr/local/bacula/var/bacula/working/2012-02-15-dir.restore.3.bsr
Where:           *None*
Replace:         always
FileSet:         dbfs
Backup Client:   2012-02-15-fd
Restore Client:  2012-02-15-fd
Storage:         dbsd
When:            2012-02-16 00:08:05
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=6
 
[root@balucaclient etc]# ls /var/www/html/    
index1.html  index2.html
#显示fd上已经完全恢复Jobid为2前所有的文件
 
七、bconsole中相关命名说明
1. status  查看director、client、storage 状态。

Tags:

备份恢复
首页 上一页 [3] [4] [5] [6]  下一页 尾页

相关文章

文章评论

软件按字母排列: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z