Chinaunix首页 | 论坛 | 博客
  • 博客访问: 179469
  • 博文数量: 32
  • 博客积分: 3453
  • 博客等级: 上尉
  • 技术积分: 244
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-04 21:27
文章分类
文章存档

2011年(8)

2010年(24)

分类: 服务器与存储

2011-11-07 15:28:29

文档控制

文档信息

文档名称

Bacula 管理

文档编写者

friend-sen

文档版本编号

V1.0

文档类型

技术文档

2011-09-20

备注

Bacula管理和使用没有花太多精力去测试,只简单完成了普通文件的备份和恢复操作,如果大家有环境或者有时间去,还是希望多去测试,如备份数据库、备份到磁带库等等操作。如果有完成测试的操作,希望与大家分享一下,便于大家深入了解Bacula。博客格式比较乱,附件中的文档更适合查阅。

测试环境:Bacula Server系统:Centos 5.3;Bacula Client for Linux系统:RHEL 4;Bacula Client for Windows系统:Windows 7。

所有权声明

文档里的资料多数可以在我的博客(http://sens.cublog.cn)中找到,博客中大部分文档也是在网络中引用或转载,我在这里做了整理及修改,目的是为了集大家之所长,为使用Bacula的大家提供更好帮助。如有侵权,还望通知,将予以改正。许多专业术语是我个人的理解,文档中有错误的地方,或者可以用更好的语言表达的,希望将好的建议告诉我,以便错误得到及时更正,共同为使用Bacula的大家提供便利。


1. 概述.. 2

2. Bconsole. 2

2.1. 介绍.. 2

2.2. 操作Job. 4

2.2.1. 备份Job. 4

2.2.2. 查看Job状态.. 6

2.2.3. 查看Job执行详情.. 7

2.2.4. 还原Job. 10

3. BAT- Bacula Admin Tool 17

4. Webcula. 23

4.1. 介绍.. 23

4.2. 安装.. 23

5. Bacula-Web. 31

5.1. 介绍.. 31

5.2. 安装.. 31

6. Reportula. 34

6.1. 介绍.. 34

6.2. 安装.. 34

文档下载

 

 

Bacula由五个主要部分或服务组成:Director, Console, File, Storage, and Monitor services。

那么Bacula管理部分就包含Console和Monitor Services。

Bacula已有多种管理方式,可以通过命令行控制台、图形化控制台、WEB管理页面及托盘监控软件等方式管理Bacula。主要管理工具有Bconsole(命令行控制台)、BAT(Bacula Admin Tool,基于QT的图形化控制台)、BWX(基于wxWidgets的图形化控制台)、Webacula(WEB管理)及tray-monitor(Linux平台托盘监控工具)。更多WEB管理工具可以在Bacula Wiki(http://wiki.bacula.org/doku.php?id=3rd_party_addons)中找到。

Bconsole在安装Bacula时自带,有些工具则需要在安装Bacula时添加相关参数,详细可参考Bacula安装部分。安装Bacula时,就应该决定自己需要使用什么管理工具来管理Bacula,避免之后在安装管理工具时出现难以解决的错误。

BAT有基于Windows的版本,安装基于Windows的Bacula客户端版本时,会自带BAT组件,相对在Linux下安装BAT方便。

下面简单介绍一下Bconsole、BAT以及几个主要WEB管理工具。

 

Bconsole是一个shell界面(TTY风格)的控制台,允许用户在Bacula主控端守护进程运行时管理Bacula。

运行Bconsole前先检查一下bconsole.conf是否配置正确,使用基于Windows 7的Bconsole时,运行前需要将C:\Program Files\Bacula\bconsole.conf复制到C:\ProgramData\Bacula\目录下,然后使用C:\Program Files\Bacula\bconsole.exe启动Bconsole。

运行Bconsole可以有使用以下选项。

# cd /usr/local/bacula/bin

# ./bconsole -?

Usage: bconsole [-s] [-c config_file] [-d debug_level]

-c set configuration file to file

-d set debug level to

-dt print timestamp in debug output

-n no conio

-s no signals

-u set command execution timeout to seconds

-t test - read configuration and exit

-? print this message.

在Bconsole中可以执行很多操作,如执行备份任务、还原任务、查看消息、查看任务状态等等,下面是所有可以执行的操作。

# ./bconsole

Connecting to Director ser1:9101

1000 OK: ser1-dir Version: 5.0.1 (24 February 2010)

Enter a period to cancel a command.

*

*help

Command Description

======= ===========

add Add media to a pool

autodisplay Autodisplay console messages

automount Automount after label

cancel Cancel a job

create Create DB Pool from resource

delete Delete volume, pool or job

disable Disable a job

enable Enable a job

estimate Performs FileSet estimate, listing gives full listing

exit Terminate Bconsole session

gui Non-interactive gui mode

help Print help on specific command

label Label a tape

list List objects from catalog

llist Full or long list like list command

messages Display pending messages

memory Print current memory usage

mount Mount storage

prune Prune expired records from catalog

purge Purge records from catalog

python Python control commands

quit Terminate Bconsole session

query Query catalog

restore Restore files

relabel Relabel a tape

release Release storage

reload Reload conf file

run Run a job

status Report status

setdebug Sets debug level

setip Sets new client address -- if authorized

show Show resource records

sqlquery Use SQL to query catalog

time Print current time

trace Turn on/off trace to file

unmount Unmount storage

umount Umount - for old-time Unix guys, see unmount

update Update volume, pool or stats

use Use catalog xxx

var Does variable expansion

version Print Director version

wait Wait until no jobs are running

When at a prompt, entering a period cancels the command.

*

*

 

Job

进入bconsole之后,输入run命令

*

*run

A job name must be specified.

The defined Job resources are:

1: BackupClient1

2: BackupCatalog

3: RestoreFiles

4: ser1-backup

5: ser1-restore

6: redhat-backup

7: redhat-restore

8: sen-lenovo-backup

9: sen-lenovo-restore

Select Job resource (1-9): 4

列表中的Job名对应的是bacula-dir.conf配置文件中的Job{}中的Name值。这里备份服务器ser1的数据,选择4,继续;

Select Job resource (1-9): 4

Run Backup job

JobName: ser1-backup

Level: Full

Client: ser1-fd

FileSet: ser1-backup

Pool: client-pool (From Job resource)

Storage: File (From Job resource)

When: 2011-10-24 11:14:05

Priority: 10

OK to run? (yes/mod/no):mod

系统会自动列出配置文件中的ser1-backup已定义好的设定值,因为是实时执行Job,该执行时间是当前时间,如果马上执行输入’yes’就可以了,如果要修改相关选项,需要输入’mod’,这里更改一下执行时间;

OK to run? (yes/mod/no):mod

Parameters to modify:

1: Level

2: Storage

3: Job

4: FileSet

5: Client

6: When

7: Priority

8: Pool

9: Plugin Options

Select parameter to modify (1-9): 6

Please enter desired start time as YYYY-MM-DD HH:MM:SS (return for now):

按照格式输入执行时间,时间输入之后,系统会再次提示修改后执行任务的参数,确认后输入’yes’;

Please enter desired start time as YYYY-MM-DD HH:MM:SS (return for now): 2011-10-24 11:28:30

Run Backup job

JobName: ser1-backup

Level: Full

Client: ser1-fd

FileSet: ser1-backup

Pool: client-pool (From Job resource)

Storage: File (From Job resource)

When: 2011-10-24 11:28:30

Priority: 10

OK to run? (yes/mod/no): yes

Job queued. JobId=23

*

*

已建立Job,JobId为23。

 

状态

执行status命令查看任务状态,JobId为23;

*status

Status available for:

1: Director

2: Storage

3: Client

4: All

Select daemon type for status (1-4): 4

ser1-dir Version: 5.0.1 (24 February 2010) i686-pc-linux-gnu redhat

Daemon started 19-10朲011 10:30, 10 Jobs run since started.

Heap: heap=434,176 smbytes=218,501 max_bytes=276,446 bufs=392 max_bufs=548

Scheduled Jobs:

Level Type Pri Scheduled Name Volume

===================================================================================

Full Backup 10 24-10朲011 18:18 ser1-backup *unknown*

Full Backup 10 24-10朲011 18:18 sen-lenovo-backup *unknown*

Full Backup 10 24-10朲011 18:18 redhat-backup *unknown*

Incremental Backup 10 24-10朲011 23:05 BackupClient1 *unknown*

Full Backup 11 24-10朲011 23:10 BackupCatalog *unknown*

====

Running Jobs:

Console connected at 24-10朲011 10:21

No Jobs running.

====

Terminated Jobs:

JobId Level Files Bytes Status Finished Name

====================================================================

14 Full 0 0 Cancel 24-10朲011 10:44 BackupClient1

16 Full 0 0 Cancel 24-10朲011 10:44 BackupClient1

18 Full 2 13 OK 24-10朲011 10:44 ser1-backup

19 Full 2 20 OK 24-10朲011 10:44 redhat-backup

20 Full 2 242 OK 24-10朲011 10:45 sen-lenovo-backup

22 Full 0 0 Cancel 24-10朲011 10:45 ser1-backup

15 Full 0 0 Cancel 24-10朲011 10:45 BackupCatalog

17 Full 0 0 Cancel 24-10朲011 10:45 BackupCatalog

21 Full 2 20 OK 24-10朲011 10:45 redhat-backup

23 Full 2 13 OK 24-10朲011 11:28 ser1-backup

====

系统显示JobId为23的Job已成功执行。

 

执行详情

执行messages命令查看日志。注意当Job执行完成后,系统自动将信息显示在bconsole控制台,如果信息已显示后,再次查看此任务信息,则需要查看Bacula日志文件(/usr/local/bacula/working/log)。

*messages

24-10月 11:28 ser1-dir JobId 23: Job ser1-backup.2011-10-24_11.28.14_07 waiting 16 seconds for scheduled start time.

24-10月 11:28 ser1-dir JobId 23: Start Backup JobId 23, Job=ser1-backup.2011-10-24_11.28.14_07

24-10月 11:28 ser1-dir JobId 23: Created new Volume "ser1-fd-storage-2011-10-24-id23" in catalog.

24-10月 11:28 ser1-dir JobId 23: Using Device "FileStorage"

24-10月 11:28 ser1-sd JobId 23: Labeled new Volume "ser1-fd-storage-2011-10-24-id23" on device "FileStorage" (/opt/backup).

24-10月 11:28 ser1-sd JobId 23: Wrote label to prelabeled Volume "ser1-fd-storage-2011-10-24-id23" on device "FileStorage" (/opt/bac

kup)

24-10月 11:28 ser1-dir JobId 23: Volume used once. Marking Volume "ser1-fd-storage-2011-10-24-id23" as Used.

24-10月 11:28 ser1-sd JobId 23: Job write elapsed time = 00:00:01, Transfer rate = 158 Bytes/second

24-10月 11:28 ser1-dir JobId 23: Bacula ser1-dir 5.0.1 (24Feb10): 24-10月-2011 11:28:33

Build OS: i686-pc-linux-gnu redhat

JobId: 23

Job: ser1-backup.2011-10-24_11.28.14_07

Backup Level: Full

Client: "ser1-fd" 5.0.1 (24Feb10) i686-pc-linux-gnu,redhat,

FileSet: "ser1-backup" 2011-10-17 09:26:13

Pool: "client-pool" (From Job resource)

Catalog: "MyCatalog" (From Client resource)

Storage: "File" (From Job resource)

Scheduled time: 24-10月-2011 11:28:30

Start time: 24-10月-2011 11:28:32

End time: 24-10月-2011 11:28:33

Elapsed time: 1 sec

Priority: 10

FD Files Written: 2

SD Files Written: 2

FD Bytes Written: 13 (13 B)

SD Bytes Written: 158 (158 B)

Rate: 0.0 KB/s

Software Compression: None

VSS: no

Encryption: no

Accurate: no

Volume name(s): ser1-fd-storage-2011-10-24-id23

Volume Session Id: 7

Volume Session Time: 1318991426

Last Volume Bytes: 820 (820 B)

Non-fatal FD errors: 0

SD Errors: 0

FD termination status: OK

SD termination status: OK

Termination: Backup OK

24-10月 11:28 ser1-dir JobId 23: Begin pruning Jobs older than 6 months .

24-10月 11:28 ser1-dir JobId 23: No Jobs found to prune.

24-10月 11:28 ser1-dir JobId 23: Begin pruning Jobs.

24-10月 11:28 ser1-dir JobId 23: No Files found to prune.

24-10月 11:28 ser1-dir JobId 23: End auto prune.

根据提示备份后的文件存储在了’/opt/backup/’目录,那么就去检查一下该文件是否存在

#ls –al /opt/backup/

-rw-r----- 1 root root 853 09-20 17:58 redhat-fd-storage-2011-09-20-id3

-rw-r----- 1 root root 854 10-24 10:44 redhat-fd-storage-2011-10-24-id19

-rw-r----- 1 root root 854 10-24 10:45 redhat-fd-storage-2011-10-24-id21

-rw-r----- 1 root root 854 10-24 14:16 redhat-fd-storage-2011-10-24-id31

-rw-r----- 1 root root 854 10-25 18:18 redhat-fd-storage-2011-10-25-id34

-rw-r----- 1 root root 1190 09-20 11:22 sen-lenovo-fd-storage-2011-09-20-id2

-rw-r----- 1 root root 1191 10-24 10:45 sen-lenovo-fd-storage-2011-10-24-id20

-rw-r----- 1 root root 1191 10-25 18:19 sen-lenovo-fd-storage-2011-10-25-id35

-rw-r----- 1 root root 820 10-24 10:44 ser1-fd-storage-2011-10-17-id10

-rw-r----- 1 root root 820 10-24 11:28 ser1-fd-storage-2011-10-24-id23

-rw-r----- 1 root root 932 10-24 13:54 ser1-fd-storage-2011-10-24-id25

-rw-r----- 1 root root 1044 10-24 14:06 ser1-fd-storage-2011-10-24-id27

-rw-r----- 1 root root 1045 10-24 14:08 ser1-fd-storage-2011-10-24-id29

-rw-r----- 1 root root 1045 10-25 18:18 ser1-fd-storage-2011-10-25-id33

看到该文件后,说明这个备份Job已成功。

 

还原Job run和restore命令都可以执行,但是使用run命令执行一个还原Job时,还原的数据是该Job最近一次的备份;而restore命令执行还原很早的备份Job,执行不同要求的还原Job。

  • run命令执行还原

*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: ser1-backup

5: ser1-restore

6: redhat-backup

7: redhat-restore

8: sen-lenovo-backup

9: sen-lenovo-restore

Select Job resource (1-9): 5

Run Restore job

JobName: ser1-restore

Bootstrap: /usr/local/bacula/working/ser1-backup.bsr

Where: /opt/restore

Replace: always

FileSet: ser1-backup

Backup Client:

Restore Client: ser1-fd

Storage: File

When: 2011-10-26 00:45:43

Catalog: MyCatalog

Priority: 10

Plugin Options: *None*

OK to run? (yes/mod/no): yes

Job queued. JobId=38

*

这里还原的数据是按照’ser1-restore’ Job中定义的参数去执行的,和使用run执行备份Job操作类似,这里不做详细描述。根据参数设定,还原后的数据存储在客户端’ ser1-fd’的’/opt/restore’目录下,登录该客户端之后检查一下。

[root@ser1 ~]# ls -al /opt/restore/

drwxr-xr-x 2 root root 4096 10-24 11:28 ser1

发现该目录下的文件与’ser1-restore’ Job中’FileSet’项定义的文件是一样,则表示还原成功了。关于该Job执行详情可通过messages命令查看或查看Bacula日志。

 

  • restore命令执行还原

*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): 3

这里列出了很多种还原方式,这里选择第3种,根据JobId来还原数据。执行还原之前,先到备份文件存储目录’/opt/backup/’确认一下需要还原数据的JobId;

# ls -al /opt/backup/

-rw-r----- 1 root root 853 09-20 17:58 redhat-fd-storage-2011-09-20-id3

-rw-r----- 1 root root 854 10-24 10:44 redhat-fd-storage-2011-10-24-id19

-rw-r----- 1 root root 854 10-24 10:45 redhat-fd-storage-2011-10-24-id21

-rw-r----- 1 root root 854 10-24 14:16 redhat-fd-storage-2011-10-24-id31

-rw-r----- 1 root root 854 10-25 18:18 redhat-fd-storage-2011-10-25-id34

-rw-r----- 1 root root 1190 09-20 11:22 sen-lenovo-fd-storage-2011-09-20-id2

-rw-r----- 1 root root 1191 10-24 10:45 sen-lenovo-fd-storage-2011-10-24-id20

-rw-r----- 1 root root 1191 10-25 18:19 sen-lenovo-fd-storage-2011-10-25-id35

-rw-r----- 1 root root 820 10-24 10:44 ser1-fd-storage-2011-10-17-id10

-rw-r----- 1 root root 820 10-24 11:28 ser1-fd-storage-2011-10-24-id23

-rw-r----- 1 root root 932 10-24 13:54 ser1-fd-storage-2011-10-24-id25

-rw-r----- 1 root root 1044 10-24 14:06 ser1-fd-storage-2011-10-24-id27

-rw-r----- 1 root root 1045 10-24 14:08 ser1-fd-storage-2011-10-24-id29

-rw-r----- 1 root root 1045 10-25 18:18 ser1-fd-storage-2011-10-25-id33

这里选择还原Windows客户端’ sen-lenovo-fd’在2011-10-24备份的数据,如上所示,它的JobId为20;

Select item: (1-13): 3

Enter JobId(s), comma separated, to restore: 20

You have selected the following JobId: 20

Building directory tree for JobId(s) 20 ...

1 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: /

$

输入JobId后,系统提示进入’文件选择模式’,也就是说可以选择哪些文件需要还原’mark’,哪些文件不需要还原’unmark’,还原所有文件为’mark *’。输入’mark *’之后,输入’done’完成文件选择;

cwd is: /

$ mark *

3 files marked.

$ done

Bootstrap records written to /usr/local/bacula/working/ser1-dir.restore.4.bsr

The job will require the following

Volume(s) Storage(s) SD Device(s)

===========================================================================

sen-lenovo-fd-storage-201 File FileStorage

Volumes marked with "*" are online.

2 files selected to be restored.

The defined Restore Job resources are:

1: RestoreFiles

2: ser1-restore

3: redhat-restore

4: sen-lenovo-restore

Select Restore Job (1-4): 4

Defined Clients:

1: redhat-fd

2: sen-lenovo-fd

3: ser1-fd

Select the Client (1-3): 3

Run Restore job

JobName: sen-lenovo-restore

Bootstrap: /usr/local/bacula/working/ser1-dir.restore.4.bsr

Where: /opt/restore

Replace: always

FileSet: sen-lenovo-backup

Backup Client: ser1-fd

Restore Client: ser1-fd

Storage: File

When: 2011-10-26 02:04:44

Catalog: MyCatalog

Priority: 10

Plugin Options: *None*

OK to run? (yes/mod/no): mod

选择使用其对应的还原Job和Client。如果是还原到Windows客户端,确认一下’Where’的值,也就是还原到目标目录的路径,Windows的’\’用’/’代替,例:d:/bacula.restore/。这里需要更改一下’where’值;

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 Options

Select parameter to modify (1-13): 9

Please enter path prefix for restore (/ for none): d:/bacula.restore/

Run Restore job

JobName: sen-lenovo-restore

Bootstrap: /usr/local/bacula/working/ser1-dir.restore.4.bsr

Where: d:/bacula.restore/

Replace: always

FileSet: sen-lenovo-backup

Backup Client: ser1-fd

Restore Client: ser1-fd

Storage: File

When: 2011-10-26 02:04:44

Catalog: MyCatalog

Priority: 10

Plugin 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 Options

Select parameter to modify (1-13): 6

Please enter desired start time as YYYY-MM-DD HH:MM:SS (return for now):

Run Restore job

JobName: sen-lenovo-restore

Bootstrap: /usr/local/bacula/working/ser1-dir.restore.4.bsr

Where: d:/bacula.restore/

Replace: always

FileSet: sen-lenovo-backup

Backup Client: ser1-fd

Restore Client: ser1-fd

Storage: File

When: 2011-10-26 02:15:59

Catalog: MyCatalog

Priority: 10

Plugin Options: *None*

OK to run? (yes/mod/no): yes

Job queued. JobId=43

*

修改还原数据的目的路径之后,根据提示执行完其他操作直至完成。

根据参数设定,还原后的数据存储在客户端’ sen-lenovo-fd’的’d:/bacula.restore/’目录下,登录该客户端之后检查一下。

Microsoft Windows [版本 6.1.7600]

版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\sen>d:

D:\>cd bacula.restore

D:\bacula.restore>dir

驱动器 D 中的卷是 Other

卷的序列号是 58F2-0E55

D:\bacula.restore 的目录

2011/10/26 02:20

.

2011/10/26 02:20

..

2011/10/26 02:20

c

0 个文件 0 字节

3 个目录 2,625,925,120 可用字节

发现该目录下的文件与’sen-lenovo-restore’ Job中’FileSet’项定义的文件是一样,则表示还原成功了。关于该Job执行详情可通过messages命令查看或查看Bacula日志。

注意:

  • 还原job时,如果还原的文件中含有与目的目录相同的文件名,文件将会被覆盖。避免此类问题,可先清空目的目录的文件或者设置新的还原目录(需要更改bacula-dir.conf文件中对应job的where参数);
  • 还原Windows客户端的数据,注意还原后文件的目的存储路径的写法;
  • Run执行Job还原时,是还原最近一次的备份;

 

3. BAT- Bacula Admin Tool

BAT是一个基于QT的图形化控制台程序,允许用户在Bacula主控端守护进程运行时管理Bacula。在Linux平台下使用,需要先安装QT包,配置完成后,在安装Bacula时加上-enable-bat参数。

下面介绍一下基于Windows的BAT,如下图

clip_image002

注意:右侧的显示框中可以右键,可以查看更多详细信息。

Console---显示命令执行结果,可以在Command框中输入命令。

clip_image004

Clients---显示客户端相关信息

clip_image006

FileSets---显示所有设置的FileSet项相关信息

clip_image008

Jobs---显示所有已定义的Job相关信息

clip_image010

Jobs Run---显示所有已完成的任务相关信息

clip_image012

Pools---显示所有定义的Pools相关信息

clip_image014

Media---显示已备份后的文件存储相关信息

clip_image016

Storage---显示存储端的相关信息

clip_image018

Label---Label a Volume

clip_image020

Restore---执行还原任务

clip_image022

Version Brower---查看已完成的备份任务的存储文件

clip_image024

Run---执行备份任务

clip_image026

 

4. Webcula

Webacula是一个比较友好的Bacula WEB管理工具,功能比较全面。下面介绍一下主要功能:

  • 支持Mysql,PostgreSQL,SQlite数据库;
  • 支持运行Job;
  • 挂载和卸载storages;
  • 显示Jobs的状态;
  • 显示Pools,Volumes,Storages和Clients的信息;
  • 可以执行bconsole命令,注意必须输入完整命令;
  • 通过用户才能访问WEB页面。

更多功能可访问官方网站了解。

项目主页:http://webacula.sourceforge.net/

 

安装要求

  • Bacula 3.0或以上版本;
  • 系统安装有Mysql,PostgreSQL或SQlite数据库;
  • Zend Framework 1.8.3或更高版本;
  • PHP 5.2.4或更高版本,并安装php-gd、php-pdo、php-dom、php-xml、php-mysql及php-pgsql包;
  • 一个兼容性不错的浏览器

以下是几个安装范例,可以参考:

http://thielebein.net/trac/wiki/Backup/Bacula/Webacula

http://www.java-tutorial.ch/ubuntu/webacula-installation-on-ubuntu

http://dev.uabgrid.uab.edu/wiki/WebaculaInstallation

http://softwarelivre.org/heitorfaria/blog/instalacao-webacula-3.x-gui-web

安装步骤

#tar zxf webacula-5.5.1.tar.gz

#cd webacula-5.5.1

#cd install/

检查是否符合安装要求

#./check_system_requirements.php

Webacula check System Requirements...

Current MySQL version = 5.0.45 OK

Current PostgreSQL version = 8.1.11 OK

Current Sqlite version = 3.3.6 OK

Current PHP version = 5.1.6 ERROR! Upgrade your PHP version to 5.2.4 or later

ERROR! PHP extension pdo not installed.

ERROR! PHP extension gd not installed.

php xml installed. OK

ERROR! PHP extension dom not installed.

Warning. PHP extension pdo_mysql not installed.

Warning. PHP extension pdo_pgsql not installed.

Warning. PHP extension pdo_sqlite not installed.

Warning. php-xml, php-dom extension not installed. RSS feed not work

Centos 5.0需要添加源之后才能通过yum更新PHP到5.2后的版本,升级PHP前先更新源。

#rpm --import

#vi /etc/yum.repos.d/CentOS-Base.repo

[utterramblings]

name=Jason's Utter Ramblings Repo

baseurl=

enabled=1

gpgcheck=1

gpgkey=

#yum update php*

#yum install libmcrypt

#yum install php-xml php-dom php-gd php-pdo

#yum install php-mysql php-pgsql

所有缺少的包安装完成之后,再次确认一下是否符合安装要求

#./check_system_requirements.php

Webacula check System Requirements...

Current MySQL version = 5.1.58 OK

Current PostgreSQL version = 8.1.11 OK

Current Sqlite version = 3.3.6 OK

Current PHP version = 5.2.17 OK

php pdo installed. OK

php gd installed. OK

php xml installed. OK

php dom installed. OK

php pdo_mysql installed. OK

php pdo_pgsql installed. OK

php pdo_sqlite installed. OK

php-dom, php-xml installed. OK

看到都OK了,之后还需要安装一下ZendFramework。

Download ZendFramework()

#tar zxf ZendFramework-1.11.10-minimal.tar.gz

#cd ZendFramework-1.11.10-minimal/library/

将library文件夹拷贝到webacula目录下,然后可以将webacula目录拷贝到apache的发布目录,或者自己设置webacula发布。

#cp -R Zend/ ../*/webacula-5.5.1/library/

#cp -R ../*/webacula-5.5.1 /var/www/webacula

编辑webacula的config.ini文件,如下

#cd /var/www/webacula/application/

#vi config.ini

db.adapter = PDO_MYSQL

db.config.host = localhost

db.config.username = root

;;your database password

db.config.password = "123456"

db.config.dbname = bacula

bacula.sudo = ""

bacula.bconsole = "/usr/local/bacula/bin/bconsole"

bacula.bconsolecmd = "-n -c /usr/local/bacula/bin/bconsole.conf"

[webacula]

;db.adapter = PDO_MYSQL

;db.config.host = localhost

;db.config.username = wbuser

;db.config.password = "wbpass"

;;…..

添加apache用户权限

#useradd bacula

#passwd bacula

#usermod -aG bacula apache

#chown root:bacula /usr/local/bacula/bin/bconsole

#chmod u=rwx,g=rx,o= /usr/local/bacula/bin/bconsole

#chown root:bacula /usr/local/bacula/bin/bconsole.conf

#chmod u=rw,g=r,o= /usr/local/bacula/bin/bconsole.conf

设置apache发布webacula

#vi /etc/httpd/conf.d/webacula.conf

# Apache conf

#

# Webacula - Web interface of a Bacula backup system

#

# Allows only localhost by default

#

#LoadModule rewrite_module modules/mod_rewrite.so

# AccessFileName .htaccess

# RewriteLog "/var/log/httpd/mod_rewrite.log"

# RewriteLogLevel 3

# SetEnv APPLICATION_ENV development

SetEnv APPLICATION_ENV production

Alias /webacula /var/www/webacula/html

RewriteEngine On

RewriteBase /webacula

RewriteCond %{REQUEST_FILENAME} -s [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ index.php [NC,L]

php_flag magic_quotes_gpc off

php_flag register_globals off

Options Indexes FollowSymLinks

AllowOverride All

Order deny,allow

Deny from all

Allow from 127.0.0.1

Allow from localhost

Allow from 192.168.160.0/255.255.255.0

Allow from ::1

#AuthType Basic

#AuthName "admin"

#AuthUserFile /usr/local/bacula/bin/webacula.users

#Require valid-user

#

# change the settings below

#

# Allow from

Order deny,allow

Deny from all

Order deny,allow

Deny from all

Order deny,allow

Deny from all

Order deny,allow

Deny from all

Order deny,allow

Deny from all

Order deny,allow

Deny from all

Order deny,allow

Deny from all

#

# test mod_rewrite

#

RewriteEngine On

# for test mod_rewrite

RewriteBase /webacula/test_mod_rewrite

RewriteRule ^testlink([^/]*).html$ index.php?testlink=$1 [L]

php_flag magic_quotes_gpc off

php_flag register_globals off

Options Indexes FollowSymLinks

AllowOverride All

Order deny,allow

Deny from all

Allow from 127.0.0.1

Allow from localhost

Allow from 192.168.160.0/255.255.255.0

Allow from ::1

编辑php配置文件

#vi /etc/php.ini

memory_limit = 32M

max_execution_time = 3600

编辑bacula主配置文件

#vi /usr/local/bacula/bin/bacula-dir.conf

Messages {

Name = Standard

...

catalog = all, !skipped, !saved

}

设置数据库连接设置及WEB登录用户名密码(root:123456)

#cd /var/www/webacula/install/

#vi db.conf

# See also application/config.ini

# bacula settings

db_name="bacula"

# for Sqlite only

db_name_sqlite="/usr/local/bacula/bin/working/bacula.db"

db_user="root"

# CHANGE_THIS

db_pwd="123456"

# Webacula web interface settings

#

# Built-in superuser login is 'root'

#

# CHANGE_THIS

webacula_root_pwd="123456"

执行mysql脚本

#cd Mysql/

#./10_make_tables.sh

#./20_acl_make_tables.sh

Webacula到这就完成了,重启服务

#service mysqld restart

#service httpd start

#/usr/local/bacula/bin/bacula restart

使用root(pwd:123456)登录Webacula,http://localhost/webacula/

clip_image028

访问页面时发现以下错误

Fatal error: Uncaught exception 'Zend_Exception' with message 'Directory "/var/www/webacula/data/cache" is not exists or not writable.' in /var/www/webacula/html/index.php:194
Stack trace:
#0 {main}
thrown in /var/www/webacula/html/index.php on line 194

可更改目录权限解决问题

#chmod 775 /var/www/webacula/data/cache

Webacula的使用这里就不做介绍了。

 

5. Bacula-Web

Bacula-Web通过WEB页面展示Bacula的Jobs,Pools,Volumes的状态,生成Clients及Jobs的报告。相对于Bebacula来说,Bacula-Web更易于安装。

项目主页:http://bacula-web.dflc.ch/

文档:http://bacula-web.dflc.ch/index.php/docs.html

#yum update httpd php php-gd php-gettext php-mysql

#service httpd restart

Download http://bacula-web.dflc.ch/index.php/download.html

#mkdir bacula-web

#cd bacula-web

#wget http://bacula-web.dflc.ch/tl_files/downloads/bacula-web.5.1.0-alpha.tar.gz

#tar zxf bacula-web.5.1.0-alpha.tar.gz

查看INSTALL帮助

#more INSTALL

复制到apache网页发布主目录

#cp -R bacula-web /var/www/html

#cd /var/www/html

添加apache用户访问权限

#chown -R apache:apache bacula-web

#chmod -R u=rx,g=rx,o=rx bacula-web/

#chmod ug+w bacula-web/templates_c/

编辑配置文件,设置连接数据库参数

#cd config/

#cp config.php.sample config.php

#vi config.php

/*添加以下内容 */

//MySQL bacula catalog

$config[0]['label'] = 'Backup Server';

$config[0]['host'] = 'localhost';

$config[0]['login'] = 'root';

$config[0]['password'] = '123456';

$config[0]['db_name'] = 'bacula';

$config[0]['db_type'] = 'mysql';

$config[0]['db_port'] = '3306';

至此Bacula-Web就安装完成了,重启apache服务

#service httpd restart

可以先测试一下

http://localhost/bacula-web/test.php

clip_image030

访问

http://localhost/bacula-web/

clip_image032

如果需要设置用户访问Bacula-Web,则可以通过添加apache发布设置来实现

#vi /etc/httpd/conf.d/bacula-web.conf

DocumentRoot /var/www/html/bacula-web

DirectoryIndex index.php

Alias "/bacula-web" "/var/www/html/bacula-web"

Options Indexes FollowSymLinks

AllowOverride All

Order deny,allow

Allow from 127.0.0.1

# your network

Allow from 192.168.160.0/255.255.255.0

AuthType Basic

AuthName "bacula-web"

AuthUserFile /usr/local/bacula/bin/bacula-web.users

Require valid-user

添加访问用户

#htpasswd -bc /usr/local/bacula/bin/bacula-web.users admin 123456

#service httpd restart

现在就可以通过用户验证来访问Bacula-Web。

 

Reportula和Bacula-Web功能上应该差不多,也是一个Bacula数据WEB展示工具,可以显示Jobs,Pools,Volumes的状态,生成报告。支持Mysql及PostgreSQL数据库,页面做的比Bacula-Web漂亮,但是目前还有一些bug,导致一些页面显示不正常。项目组修复这些bug后,我想Reportula应该是不错的选择。

项目主页:

Download

#yum update httpd php mysql

#unzip reportula1.0.zip

复制目录至apache网页发布目录

#cp –R reportula /var/www/html

执行sql脚本

# cd /var/www/html/reportula

# mysql -uroot -p -D bacula < create-function-pretty_size.sql

如果执行此命令是发生下面错误

ERROR 1558 (HY000) at line 1: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50045, now running 50158. Please use mysql_upgrade to fix this error.

可以通过一下命令解决问题

#mysql_upgrade -urooot -p

继续下面步骤

#mysql -uroot -p < Bacula_History_MySQL.sql

#GRANT ALL PRIVILEGES ON Bacula_History.* TO 'bacula@localhost' IDENTIFIED BY '123456';

编辑数据库配置文件,设置数据库强制区分大小写(可选)

#vi /etc/my.cnf

lower_case_table_names=2

#service mysqld restart

编辑配置文件,设置数据库连接设置

#vi /var/www/html/reportula/application/config/database.php

$db['default']['hostname'] = 'localhost';

$db['default']['username'] = 'bacula';

$db['default']['password'] = '';

$db['default']['database'] = 'bacula';

$db['default']['dbdriver'] = 'mysql';

$db['default']['dbprefix'] = '';

$db['default']['pconnect'] = TRUE;

$db['default']['db_debug'] = TRUE;

$db['default']['cache_on'] = FALSE;

$db['default']['cachedir'] = '';

$db['default']['char_set'] = 'utf8';

$db['default']['dbcollat'] = 'utf8_general_ci';

$db['default']['swap_pre'] = '';

$db['default']['autoinit'] = TRUE;

$db['default']['stricton'] = FALSE;

$db['history']['hostname'] = "localhost";

$db['history']['username'] = "bacula";

$db['history']['password'] = "";

$db['history']['database'] = "Bacula_History";

$db['history']['dbdriver'] = "mysql";

$db['history']['dbprefix'] = "";

$db['history']['pconnect'] = TRUE;

$db['history']['db_debug'] = FALSE;

$db['history']['cache_on'] = FALSE;

$db['history']['cachedir'] = "";

$db['history']['char_set'] = "utf8";

$db['history']['dbcollat'] = "utf8_general_ci";

$db['history']['swap_pre'] = "";

$db['history']['autoinit'] = TRUE;

$db['history']['stricton'] = FALSE;

至此Reportula就安装完成。

clip_image034

 

 

文档下载 Bacula 管理.pdf   

阅读(7150) | 评论(0) | 转发(1) |
0

上一篇:Bacula 配置

下一篇:没有了

给主人留下些什么吧!~~