bacula服务器备份系统备份恢复等操作

在前面博客中讲了bacula的安装与配置,接下来简单介绍一下bacula服务的开启与一些基本操作。

一、首先要开启服务

在服务器端运行root@bjx-virtual-machine:/opt/bacula/etc# ./bacula start
Starting the Bacula Storage daemon
Starting the Bacula Director daemon

开启了服务,接下来的步骤只是在第一次运行bacula时候运行即可:

./bconsole
Connecting to Director server:9101
1000 OK: server-dir Version: 5.2.6 (21 February 2012)
Enter a period to cancel a command.
*label  #创建新的卷来存储备份
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
Automatically selected Storage: File
Enter new Volume name: backup  #新建的卷的名称
Defined Pools:
1: Default
2: File
3: Scratch
Select the Pool (1-3): 1  #选择Pool
Connecting to Storage daemon File at server:9103 ...
Sending label command for Volume "backup" Slot 0 ...
3000 OK label. VolBytes=193 DVD=0 Volume="backup" Device="FileStorage" (/tmp/backup)
Catalog record for Volume "backup", Slot 0  successfully created.
Requesting to mount FileStorage ...
3906 File device ""FileStorage" (/tmp/backup)" is always mounted.
*exit  #退出

注意:如果显示connection to 9101........总是连不上,肯定是配置文件中的name和password有不一致的地方,详细检查修改即可

二、这样服务器端就运行起来了,接下来的操作都在FD端进行。 

FD端运行:

./bacula start  #启动进程
Starting the Bacula File daemon
[root@client bin]# ./bconsole  #开始备份
Connecting to Director server:9101
1000 OK: server-dir Version: 5.2.6 (21 February 2012)
Enter a period to cancel a command.
*run  #开始备份
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
A job name must be specified.
The defined Job resources are:
1: BackupClient1
2: BackupCatalog
3: RestoreFiles
4: FullBackup




Select Job resource (1-4): 4  #选择要执行的job
Run Backup job
JobName:  FullBackup
Level:    Full
Client:   ubuntu-fd 
FileSet:  Full Set
Pool:     File (From Job resource)
Storage:  File (From Job resource)
When:     2013-01-27 19:20:41
Priority: 10
OK to run? (yes/mod/no): yes  #开始执行备份job
Job queued. JobId=14
*status  #查看job状态
Status available for:
1: Director
2: Storage
3: Client
4: All
Select daemon type for status (1-4): 3  #选择查看哪一端的状态
The defined Client resources are:
1: server-fd
2: ubuntu-fd
Select Client (File daemon) resource (1-2): 2  #选择客户端
Connecting to Client client-fd at client-fd:9102


client-fd Version: 5.2.6 (21 February 2012)  i686-pc-linux-gnu redhat
Daemon started 27- 1013 19:14. Jobs: run=1 running=0.
Heap: heap=0 smbytes=90,848 max_bytes=171,749 bufs=60 max_bufs=109
Sizeof: boffset_t=8 size_t=4 debug=0 trace=0
Running Jobs:
Director connected at: 27- 1013 19:20
No Jobs running.
====
Terminated Jobs:
 JobId  Level    Files      Bytes   Status   Finished        Name 
======================================================================
    14  Full         29    19.20 M  OK       27- 1013 19:20 FullBackup
====
You have messages.
*exit

接下来执行还原数据操作:

./bconsole
Connecting to Director server:9101
1000 OK: server-dir Version: 5.2.6
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): 5
Defined Clients:
1: server-fd
2: client-fd
Select the Client (1-2): 2
Automatically selected FileSet: dbfs
+-------+-------+----------+------------+---------------------+--------------------+
| JobId | Level | JobFiles | JobBytes   | StartTime           | VolumeName         |
+-------+-------+----------+------------+---------------------+--------------------+
|    14 | F     |       29 | 19,207,422 | 2013-01-27 19:20:46 | db-2013-01-27-id14 |
+-------+-------+----------+------------+---------------------+--------------------+


You have selected the following JobId: 14


Building directory tree for JobId(s) 14 ...
24 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 *  #“*”表示还原所有的备份文件,可以指定只还原某一文件,具体命令自己google一下吧
29 files marked.
$ done
Bootstrap records written to /usr/local//bacula/bin/working/server-dir.restore.1.bsr


The job will require the following
Volume(s)                 Storage(s)                SD Device(s)
===========================================================================
db-2013-01-27-id14        dbsd                      FileStorage


Volumes marked with "*" are online.
29 files selected to be restored.


Run Restore job
JobName:         RestoreFiles
Bootstrap:       /usr/local//bacula/bin/working/server-dir.restore.1.bsr
Where:           /tmp/bacula-restores
Replace:         always
FileSet:         Full Set
Backup Client:   client-fd
Restore Client:  client-fd
Storage:         File 
When:            2013-01-27 19:31:28
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): mod  #这个地方注意一下,如果要还原到client原位置则按以下步骤
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): /
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /usr/local//bacula/bin/working/chenyi-dir.restore.1.bsr
Where:
Replace:         always
FileSet:         Full Set
Backup Client:   client-fd
Restore Client:  client-fd
Storage:         File
When:            2013-01-27 19:31:28
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=15
*exit

查询备份状态:

root@bjx-virtual-machine:/opt/bacula/etc# ./bconsole
Connecting to Director 193.168.3.59:9101
1000 OK: 1 ubuntu-dir Version: 7.0.5 (28 July 2014)
Enter a period to cancel a command.
*status
Status available for:
     1: Director
     2: Storage
     3: Client
     4: Scheduled
     5: All
Select daemon type for status (1-5): 3
Automatically selected Client: ubuntu-fd
Connecting to Client ubuntu-fd at 192.168.3.59:9102


ubuntu-fd Version: 7.0.5 (28 July 2014)  i686-pc-linux-gnu ubuntu 16.04
Daemon started 16-7月017 14:01. Jobs: run=0 running=0.
 Heap: heap=135,168 smbytes=134,337 max_bytes=134,424 bufs=61 max_bufs=62
 Sizes: boffset_t=8 size_t=4 debug=0 trace=0 mode=0,0 bwlimit=0kB/s


Running Jobs:
Director connected at: 16-7月017 15:56
No Jobs running.
====


Terminated Jobs:
 JobId  Level    Files      Bytes   Status   Finished        Name 
===================================================================
    12  Incr          0         0   OK       05-5月017 23:05 BackupClient1
    13  Full          1    60.61 K  OK       05-5月017 23:10 BackupCatalog
    14  Incr          0         0   OK       06-5月017 23:05 BackupClient1
    15  Full          1    66.59 K  OK       06-5月017 23:10 BackupCatalog
    16  Full         15    13.27 M  OK       07-5月017 23:05 BackupClient1
    17  Full          1    74.14 K  OK       07-5月017 23:10 BackupCatalog
    18  Incr          0         0   OK       08-5月017 23:05 BackupClient1
    19  Full          1    80.09 K  OK       08-5月017 23:10 BackupCatalog
====
You have messages.
*


注意:如果在链接客户端时候显示connecting to 9102......,首先查看9102端口是否被其他进程所占用,第二查看fd端配置文件的name和password与服务器端文件中的是否一致。

对于bacula服务器的部署,建议大家不要使用最新版7.4以后的版本,目前网上大都是之前版本的教程,如果真有需求的话也可以通过阅读官方文档来使用,如果大家在部署过程中有什么问题,可以在我的博客下面留言。



  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值