Bacula 管理

文檔控制 php

文檔信息html

文檔名稱java

Bacula 管理python

文檔編寫者mysql

friend-senlinux

文檔版本編號web

V1.0sql

文檔類型shell

技術文檔數據庫

文檔版本日期

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

文檔下載

 

 

1. 概述

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管理工具。

 

2. Bconsole

2.1. 介紹

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 <file> set configuration file to file

-d <nn> set debug level to <nn>

-dt print timestamp in debug output

-n no conio

-s no signals

-u <nn> set command execution timeout to <nn> 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.

*

*

 

2.2. 操做Job

2.2.1. 備份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。

 

2.2.2. 查看Job狀態

執行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已成功執行。

 

2.2.3. 查看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已成功。

 

2.2.4. 還原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: <NULL>

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 <DIR> .

2011/10/26 02:20 <DIR> ..

2011/10/26 02:20 <DIR> 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_p_w_picpath002

注意:右側的顯示框中能夠右鍵,能夠查看更多詳細信息。

Console---顯示命令執行結果,能夠在Command框中輸入命令。

clip_p_w_picpath004

Clients---顯示客戶端相關信息

clip_p_w_picpath006

FileSets---顯示全部設置的FileSet項相關信息

clip_p_w_picpath008

Jobs---顯示全部已定義的Job相關信息

clip_p_w_picpath010

Jobs Run---顯示全部已完成的任務相關信息

clip_p_w_picpath012

Pools---顯示全部定義的Pools相關信息

clip_p_w_picpath014

Media---顯示已備份後的文件存儲相關信息

clip_p_w_picpath016

Storage---顯示存儲端的相關信息

clip_p_w_picpath018

Label---Label a Volume

clip_p_w_picpath020

Restore---執行還原任務

clip_p_w_picpath022

Version Brower---查看已完成的備份任務的存儲文件

clip_p_w_picpath024

Run---執行備份任務

clip_p_w_picpath026

 

 

 

4. Webcula

4.1. 介紹

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

  • 支持Mysql,PostgreSQL,SQlite數據庫;
  • 支持運行Job;
  • 掛載和卸載storages;
  • 顯示Jobs的狀態;
  • 顯示Pools,Volumes,Storages和Clients的信息;
  • 能夠執行bconsole命令,注意必須輸入完整命令;
  • 經過用戶才能訪問WEB頁面。

更多功能可訪問官方網站了解。

項目主頁:http://webacula.sourceforge.net/

 

4.2. 安裝

安裝要求

  • 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 http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

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

[utterramblings]

name=Jason's Utter Ramblings Repo

baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/

enabled=1

gpgcheck=1

gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

#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(http://framework.zend.com/download/latest

#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

<Directory /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

</Directory>

#

# change the settings below

#

# Allow from <your network>

<Directory /var/www/webacula/docs>

Order deny,allow

Deny from all

</Directory>

<Directory /var/www/webacula/application>

Order deny,allow

Deny from all

</Directory>

<Directory /var/www/webacula/languages>

Order deny,allow

Deny from all

</Directory>

<Directory /var/www/webacula/library>

Order deny,allow

Deny from all

</Directory>

<Directory /var/www/webacula/install>

Order deny,allow

Deny from all

</Directory>

<Directory /var/www/webacula/tests>

Order deny,allow

Deny from all

</Directory>

<Directory /var/www/webacula/data>

Order deny,allow

Deny from all

</Directory>

#

# test mod_rewrite

#

<Directory /var/www/webacula/html/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

</Directory>

編輯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_p_w_picpath028

訪問頁面時發現如下錯誤

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

5.1. 介紹

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

 

 

5.2. 安裝

#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_p_w_picpath030

訪問

http://localhost/bacula-web/

clip_p_w_picpath032

若是須要設置用戶訪問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"

<Directory "/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

</Directory>

添加訪問用戶

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

#service httpd restart

如今就能夠經過用戶驗證來訪問Bacula-Web。

 

6. Reportula

6.1. 介紹

Reportula 和Bacula-Web功能上應該差很少,也是一個Bacula數據WEB展現工具,能夠顯示Jobs,Pools,Volumes的狀態,生成報告。支 持Mysql及PostgreSQL數據庫,頁面作的比Bacula-Web漂亮,可是目前還有一些bug,致使一些頁面顯示不正常。項目組修復這些 bug後,我想Reportula應該是不錯的選擇。

項目主頁:http://www.newitperson.com/reportula/

 

 

6.2. 安裝

Download http://www.newitperson.com/reportula/index.php/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就安裝完成。

http://localhost/reportula

clip_p_w_picpath034

相關文章
相關標籤/搜索