雄关漫道真如铁,而今迈步从头越。
全部博文(348)
分类: LINUX
2012-07-02 09:30:12
Bacula是款开源免费的基于网络的备份工具,可以在网络上各种不同的系统之间,实现文件的备份、恢复和验证等功能。它是基于传统的客户/服务器模式的网络备份程序,被誉为开源平台下
最优秀的网络备份工具之一。其功能强大完全可以和商用备份软件相媲美。Bacula支持完全备份,差异备份,增量备份;支持把备份写到硬盘文件中,也支持写到磁带中,支持多平台异构系统之
间的备份。
一、主服务器 (红色字体是维护人员需要交换的命令)
#cd /home/bacula
##进入bacula安装目录
#./bacula
Connecting to Director 10.10.2.226:9101
1000 OK: linux-0fdr-dir Version: 2.4.3 (10 October 2008)
Enter a period to cancel a command.
*run
Automatically selected Catalog: dbcatalog
Using Catalog "dbcatalog"
A job name must be specified.
The defined Job resources are:
1: dbjob
2: restrory
Select Job resource (1-2): 1
Run Backup job
JobName: dbjob
Level: Full
Client: dbfd
FileSet: dbfs
Pool: dbpool (From Job resource)
Storage: dbsd (From Job resource)
When: 2012-06-25 15:23:14
Priority: 10 OK to run? (yes/mod/no): yes
Job queued. JobId=990
*list jobs
990| dbjob | 2012-06-25 15:23:18 | B | F | 0 | 0 | R | //这里会出现一个列表,我当前只复制
最新的一个JOBID,这里注意红色的R表示已
经在运行了,要是E或者C就是有问题了,要
是T就表示复制完成了.
*status
Status available for:
1: Director
2: Storage
3: Client
4: All Select daemon type for status (1-4): 3
Automatically selected Client: dbfd
Connecting to Client dbfd at 10.10.2.162:9102
……………………………………………………… //这里省略一部分输出信息
54 Full 1,628 9. 7M OK 25- 8 2012-06-25 15:27 dbjob
//看到这里已经显示OK了,表示备份成功
现在去看看备份路径下面是否生成了备份文件
# du -sh *
9.7M fzh
可以看到这个卷有9.7M的大小了,原来是4K的文件,再次证明了备份成功了.
下面做还原的操作,我们把client端的被备份目录下面文件进行删除
[root@localhost bacula]# rm -rf *
[root@localhost bacula]# ls
二、directory端还原操作
# ./bconsole
Connecting to Director 10.10.2.226:9101
1000 OK: linux-0fdr-dir Version: 2.4.3 (10 October 2008)
Enter a period to cancel a command. *restore
Automatically selected Catalog: dbcatalog
Using Catalog "dbcatalog"
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: Cancel Select item: (1-12): 5
Automatically selected Client: dbfd
Automatically selected FileSet: dbfs
+-------+-------+----------+-----------+---------------------+------------+
| JobId | Level | JobFiles | JobBytes | StartTime | VolumeName |
+-------+-------+----------+-----------+---------------------+------------+
| 90 | F | 1,628 | 9,773,751 | 2009-08-25 15:23:18 | woyun |
+-------+-------+----------+-----------+---------------------+------------+
You have selected the following JobId: 54
Building directory tree for JobId 54 ... +++++++++++++++++++++++++++++++++++++++++++++++++
1 Job, 1,621 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 home
1,628 files marked. $ done
Bootstrap records written to /var/bacula/working/linux-0fdr-dir.restore.1.bsr
The job will require the following
Volume(s) Storage(s) SD Device(s)
===========================================================================
fzh dbsd dbdev
1,628 files selected to be restored.
Run Restore job
JobName: restrory
Bootstrap: /var/bacula/working/linux-0fdr-dir.restore.1.bsr
Where: /home/bacula/
Replace: always
FileSet: dbfs
Backup Client: dbfd
Restore Client: dbfd
Storage: dbsd
When: 2009-08-25 16:09:03
Catalog: dbcatalog
Priority: 10 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 Select parameter to modify (1-12): 9
Please enter path prefix for restore (/ for none): /home/bacula
Run Restore job
JobName: restrory
Bootstrap: /var/bacula/working/linux-0fdr-dir.restore.1.bsr
Where: /home/bacula
Replace: always
FileSet: dbfs
Backup Client: dbfd
Restore Client: dbfd
Storage: dbsd
When: 2009-08-25 16:09:03
Catalog: dbcatalog
Priority: 10
OK to run? (yes/mod/no): yes
Job queued. JobId=55 *exit
OK还原完成,我们现在到client端看看有什么还原回来
[root@localhost bacula]# ls
mysql.sql fzh.txt
看到已经还原回来了。
fengzhanhai2012-12-07 09:36:26