分类: LINUX
2009-08-25 17:03:23
#tar zxvf bacula-2.4.3.tar.gz
# cd bacula-2.4.3
#./configure --enable-client-only
#make&&make install
默认安装在/etc/bacula/目录下
#more bacula-fd.conf
#####################################################################
FD配置:
Director
Name = linux-0fdr-dir //这里要与directory的name相同
Password = "Nd+Yuqe+Kd5wBc1S9uMTEGTNqNIe1cupnfuOdwboej6Z"//这里与directory中client的password相同
}
Director { //这个是做监控的配置
Name = linux-0fdr-mon
Password = "MJ8SyFywMm+4ntJf2EupggRWIWE6LozmLfIKC8J9nYt7"
Monitor = yes
}
FileDaemon {
Name = dbfd //这里要与diretory的 job里的client相同
FDport = 9102
FDAddress=10.10.2.162 //被备份服务器的IP
WorkingDirectory = /var/bacula/working
Pid Directory = /var/run
Maximum Concurrent Jobs = 20
}
#bacula-ctl-fd start
经过艰辛万苦终于走到了这一步,不容易啊,好现在备份下10.10.2.162的/home/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: 2009-08-25 15:23:14
Priority: 10
OK to run? (yes/mod/no): yes
Job queued. JobId=54
*list jobs
54 | dbjob | 2009-08-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.773 M OK 25- 8?009 15:27 dbjob
//看到这里已经显示OK了,表示备份成功
现在去看看备份路径下面是否生成了备份文件
# du -sh *
9.7M woyun
可以看到这个卷有9.4M的大小了,原来是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 |
+-------+-------+----------+-----------+---------------------+------------+
| 54 | 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)
===========================================================================
woyun 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
bacula-2.4.3 bacula-2.4.3.tar.gz
看到了已经还原回来了,说明我们的还原操作已经实现了.