七、bconsole中相关命名说明
1. status 查看director、client、storage 状态。
[root@baculaserver etc]# ./bconsole
Connecting to Director 192.168.1.10:9101
1000 OK: baculaserver-dir Version: 5.2.10 (28 June 2012)
Enter a period to cancel a command.
*status
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: 192.168.1.11-fd
2: 192.168.1.12-fd
Select Client (File daemon) resource (1-2): 1
Connecting to Client 192.168.1.11-fd at 192.168.1.11:9102
2012-02-15-fd Version: 5.2.10 (28 June 2012) i686-pc-linux-gnu RedHat Enterprise release
Daemon started 14- 1212 09:16, 6 Jobs run since started.
Heap: heap=516,096 smbytes=81,546 max_bytes=154,559 bufs=68 max_bufs=95
Sizeof: boffset_t=8 size_t=4 debug=0 trace=0
Running Jobs:
Director connected at: 14- 1212 09:16
No Jobs running.
====
Terminated Jobs:
Terminated Jobs:
JobId Level Files Bytes Status Finished Name
======================================================================
12 08:57 192.168.1.11_web_job
12 08:58 192.168.1.11_web_job
<span arial="" narrow',="" arial,="" serif;="" font-size:="" 14px;="" line-height:="" 28px;="" "="" style="color: rgb(44, 44, 44); font-family: 宋体;">3 Diff 100 14 M OK 14-Dec-12 08:59 192.168.1.11_web_job
4 2,488 121.14 M OK 14-Dec-12 09.09 Restore_192.168.1.11_web_job
====
也可以
status dir 查看director 的状态
status client 查看 client 的状态
status storage 查看 storage 的状态
2. show 查看资源信息。
pools filesets clients storages schedule jobs message
3. list llist
list pools | jobs | jobtotals | media <pool=pool-name> | files <jobid=nn>
4. run 手动运行一次编好的任务。
5. reload 从新载入配置文件(当修改配置文件后用这个,不需要停止服务)
6. estimate 对某次任务进行评估。它会连接到客户端,并输出这次任务的fileset 中 文件数,和这次备份任务所占的空间。
7. purge prune
一般不会用到,我们设定的是过期自动清除。
purge 危险!!!!! 这是一个危险命令。他能清除一个客户端的所有备份任务,文件,和卷。
prune 这个命令和 purge 相似,但安全很多,它只会清除过期的文件,任务,和卷。
8. time 查看时间。
9. delete 删除volume , pool 或某次任务。
10. disable 和 enable 是一对,它可以禁止和启用某个任务。
11 cancel 取消一次正在运行的任务。例如:某次任务由于设置不当,卡住不动了,我们就可以使用这条命令,去取消这次任务。
cancel 20 取消任务ID=20 的任务。
12 update 修改 volumes ,pool 参数。
此实例并不是我在真实环境上的IP,也许有漏改的地方,欢迎指正。一般服务器都有两个网卡,一个接内网,一个接公网,若要备份的FD有内网,而且与DIR和SD所在的服务器能用内网连通,那请尽量使用内网备份,若没有内网,则只能使用公网IP进行备份,Client和Storage的对应IP都要写成外网IP。若将SD布署到另一台服务器上,也是可以的,只需要将bacula安装到SD服务器上(安装方法与安装baculaserver相同),只是只在SD服务器上配置bacula-sd.conf这个文件,当然多SD也是可以实现的,但最好在bacula-sd.conf文件的Storage段中添加SDAddress = 116.204.96.213,如下
Storage { # definition of myself
Name = hk02.mazentop.com-sd
SDPort = 9103 # Director's port
WorkingDirectory = "/usr/local/bacula/"
Pid Directory = "/usr/local/bacula/bin/working"
Maximum Concurrent Jobs = 20
SDAddress = 116.204.96.213 #添加这行
}
但多SD布署时,应该一开始就布署好,本人亲测,在后来再添加另一个SD不成功。
写了一个脚本,可以将备份的状态以网页的形式来查看:
#!/bin/bash
egrep 'JobId:|Job:|Backup Level:|End time:|SD Files Written:|Last Volume Bytes:|Termination:' /usr/local/bacula/log |awk -F": " '{print $2}' |awk 'NR%7==1 {print $1} NR%7==2
{gsub(/_/,"-",$0);gsub(/database/,"db",$0);print $1} NR%7==3 {gsub(/Differential,/,"Diff",$0);gsub(/Incremental,/,"Incr",$0);print $1} NR%7==4 {sub(/ 1月/,"01",$0);sub(/ 2月/,"
02",$0);sub(/ 3月/,"03",$0);sub(/ 4月/,"04",$0);sub(/ 5月/,"05",$0);sub(/ 6月/,"06",$0);sub(/ 7月/,"07",$0);sub(/ 8月/,"08",$0);sub(/ 9月/,"09",$0);sub(/10月/,"10",$0);sub(/11>
月/,"11",$0);sub(/12月/,"12",$0);print $1"-"$2} NR%7==5 {print $0} NR%7==6 {sub(/(/,"",$0);sub(/)/,"",$0);print $2$3} NR%7==0 {sub(/Backup Error/,"Error",$0);sub(/Canceled/,"
Cance",$0);print $2}' |awk -F"-" 'NR%7==2 {print $1"-"$2} NR%7==4 {print $3"-"$2"-"$1" "$4} NR%7!=2 && NR%7!=4 {print $0}'|awk 'NR%7==1 {printf $0"t"} NR%7==2 {printf $0"t"}
NR%7==3 {printf $0"t"} NR%7==4 {printf $0"t"} NR%7==5 {printf $0"t"} NR%7==6 {printf $0"t"} NR%7==0 {printf $0"n"}' |awk -F"t" '{print $1"t"$2" t"$3"t"$7"t "$4"t"
$6"t"$5}' |sort -nr |awk 'BEGIN {print "nJobIdtJobnametttLeveltStatust FinishedtimettBytest Filesn=============================================================
========================================="} {print $0} END {print "=====================================================================================================nJobId
tJobnametttLeveltStatust FinishedtimettBytest Filesn"}' > /home/janus2.mazentop.com/public_html/backup #这个是网站的家目录,然后将这个脚本写在crontab中执行,然后输入你定义的访问url就可以了。若是像我们公司备份的服务器太多,要是完全显示的话,就会很多,我只显示两天,脚本如下:
#!/bin/bash
egrep 'JobId:|Job:|Backup Level:|End time:|SD Files Written:|Last Volume Bytes:|Termination:' /usr/local/bacula/log |awk -F": " '{print $2}' |awk 'NR%7==1 {print $1} NR%7==2
{gsub(/_/,"-",$0);gsub(/database/,"db",$0);print $1} NR%7==3 {gsub(/Differential,/,"Diff",$0);gsub(/Incremental,/,"Incr",$0);print $1} NR%7==4 {sub(/ 1月/,"01",$0);sub(/ 2月/,"
02",$0);sub(/ 3月/,"03",$0);sub(/ 4月/,"04",$0);sub(/ 5月/,"05",$0);sub(/ 6月/,"06",$0);sub(/ 7月/,"07",$0);sub(/ 8月/,"08",$0);sub(/ 9月/,"09",$0);sub(/10月/,"10",$0);sub(/11>
月/,"11",$0);sub(/12月/,"12",$0);print $1"-"$2} NR%7==5 {print $0} NR%7==6 {sub(/(/,"",$0);sub(/)/,"",$0);print $2$3} NR%7==0 {sub(/Backup Error/,"Error",$0);sub(/Canceled/,"
Cance",$0);print $2}' |awk -F"-" 'NR%7==2 {print $1"-"$2} NR%7==4 {print $3"-"$2"-"$1" "$4} NR%7!=2 && NR%7!=4 {print $0}'|awk 'NR%7==1 {printf $0"t"} NR%7==2 {printf $0"t"}
NR%7==3 {printf $0"t"} NR%7==4 {printf $0"t"} NR%7==5 {printf $0"t"} NR%7==6 {printf $0"t"} NR%7==0 {printf $0"n"}' |awk -F"t" '{print $1"t"$2" t"$3"t"$7"t "$4"t"
$6"t"$5}' |sort -nr |egrep "`date +%Y-%m-%d`|`date -d "-1 days" +%Y-%m-%d`" |awk 'BEGIN {print "<pre>nJobIdtJobnametttLeveltStatust FinishedtimettBytest Filesn
======================================================================================================"} {print $0} END {print "================================================
=====================================================nJobIdtJobnametttLeveltStatust FinishedtimettBytest Filesn</pre>"}' > /home/janus2.mazentop.com/public_html
/index.html
访问效果如下:
JobId Jobname Level Status Finishedtime Bytes Files ===================================================================================================== 280 50.23.166.164-db Incr OK 2012-12-14 00:21:18 11.47MB 62 279 50.23.166.163-web Incr OK 2012-12-14 00:18:26 622.7KB 238 278 50.23.166.163-db Incr OK 2012-12-14 00:08:05 8.064MB 45 277 50.23.166.162-web Incr OK 2012-12-14 00:06:05 70.78MB 5,404 276 50.23.166.162-db Incr OK 2012-12-14 00:00:51 47.68MB 4 275 67.228.83.36-web Full OK 2012-12-13 08:34:23 10.48GB 354,907 274 67.228.83.36-db Incr OK 2012-12-13 03:26:01 19.00MB 3 273 67.228.83.35-web Incr OK 2012-12-13 03:24:56 3.788MB 1,143 272 67.228.83.35-db Incr OK 2012-12-13 03:22:20 40.99MB 3 271 67.228.83.34-web Incr OK 2012-12-13 03:22:01 16.27MB 2,555 270 67.228.83.34-db Incr OK 2012-12-13 03:19:53 5.307MB 5
本文出自 “别有天地” 博客,请务必保留此出处http://liuqs.blog.51cto.com/4933198/1088882
转载于:https://blog.51cto.com/fodaa/1721890