用Bacula做服务器和PC的备份
现在越来越多的服务器都迁移到云平台上了,在云上由于有容器之类的软件来做备份镜像之类的可能是容易了很多。不过有些时候后还是需要有Bacula这样类型的软件来做一些备份。
以下是OSChina上面对Becula的介绍(这里节选了一部分):
Bacula是一套计算机程序,允许系统管理员来管理备份,恢复和核查在网络上的计算机数据。 它可以备份到不同类型的媒体,包括磁带和磁盘。在技术方面,它是一个网络客户机/服务器的备份程序。相对易于使用和高效,同时提供许多先进的存储管理功 能,可以很容易地找到和恢复丢失或损坏的文件。由于它采用模块化设计,具有很好的伸缩性。http://www.oschina.net/p/bacula/
实际使用过程中,由于存储部分用的是freenas搭建的平台,上面可用的是一个比较老的一个版本5.2.x。
主要分以下几个部件来配置:
Bacula Director (bacula-dir)中心调度服务器上安装
Bacula Console 查询管理任务的命令行客户端,随中心调度服务器一同安装
Bacula File (bacula-fd) 待备份的机器上安装
Bacula Storage (bacula-sd) 存储的机器上安装
首先在CentOS上安装的bacula-dir和console, 以下是一些资料和使用效果:
On CentOS
http://www.server-world.info/en/note?os=CentOS_6&p=bacula&f=4
http://www.bacula.com.br/manual/Getting_Started_with_Bacula.html
Bacula
The Bacula plugin allows you to connect your FreeNAS servers to this powerful
open source backup tool. This plugin includes
file daemons (backup clients),
directors (backup server), and
storage daemons (back end).
Bacula itself,
however, is a bit of a challenge to get up and running.
http://forums.freenas.org/index.php?threads/bacula-sd-plugin.8212/
https://github.com/williambr/freenas-bacula
http://www.bareos.org/en/
copy to tape:http://www.backupcentral.com/phpBB2/two-way-mirrors-of-external-mailing-lists-3/bacula-25/how-to-copy-bacula-volumes-from-nas-to-tape-117062/
ubuntu: https://www.digitalocean.com/community/tutorials/how-to-configure-remote-backups-using-bacula-in-an-ubuntu-12-04-vps
jail ip:http://forums.freenas.org/index.php?threads/jail-is-assigned-ip-but-jls-shows-no-assigned-ip.15733/#post-79039On Proxy:
[root@proxy ~]# /etc/rc.d/init.d/bacula-dir start
Run Backup: http://www.server-world.info/en/note?os=CentOS_6&p=bacula&f=4
Last login: Sat Sep 13 02:24:09 2014 from 113.235.122.51
[root@proxy ~]# bconsole
Connecting to Director localhost:9101
1000 OK: bacula-dir Version: 5.0.0 (26 January 2010)
Enter a period to cancel a command.
*label
Automatically selected Catalog: MyCatalog
Using Catalog “MyCatalog”
Automatically selected Storage: File
Enter new Volume name: TestNewProxy-20140913
Defined Pools:
1: Default
2: File
3: Scratch
Select the Pool (1-3): 2
Connecting to Storage daemon File at 148.251.233.188:9103 …
Sending label command for Volume “TestNewProxy-20140913″ Slot 0 …
3000 OK label. VolBytes=213 DVD=0 Volume=”TestNewProxy-20140913″ Device=”FileSto
rage” (/tmp)
Catalog record for Volume “TestNewProxy-20140913”, Slot 0 successfully created.
Requesting to mount FileStorage …
3906 File device “”FileStorage” (/tmp)” is always mounted.
You have messages.
*
12-Sep 23:05 bacula-dir JobId 187: No prior Full backup Job record found.
12-Sep 23:05 bacula-dir JobId 187: No prior or suitable Full backup found in cat
alog. Doing FULL backup.
12-Sep 23:05 bacula-dir JobId 187: Start Backup JobId 187, Job=BackupClient1.201
4-09-12_23.05.00_03
12-Sep 23:05 bacula-dir JobId 187: Warning: bsock.c:129 Could not connect to Sto
rage daemon on 148.251.233.188:9103. ERR=Connection refused
Retrying …
12-Sep 23:10 bacula-dir JobId 187: Warning: bsock.c:129 Could not connect to Sto
rage daemon on 148.251.233.188:9103. ERR=Connection refused
Retrying …
12-Sep 23:15 bacula-dir JobId 187: Warning: bsock.c:129 Could not connect to Sto
rage daemon on 148.251.233.188:9103. ERR=Connection refused
Retrying …
12-Sep 23:20 bacula-dir JobId 187: Warning: bsock.c:129 Could not connect to Sto
rage daemon on 148.251.233.188:9103. ERR=Connection refused
Retrying …
12-Sep 23:25 bacula-dir JobId 187: Warning: bsock.c:129 Could not connect to Sto
rage daemon on 148.251.233.188:9103. ERR=Connection refused
Retrying …
12-Sep 23:31 bacula-dir JobId 187: Warning: bsock.c:129 Could not connect to Sto
rage daemon on 148.251.233.188:9103. ERR=Connection refused
Retrying …
12-Sep 23:35 bacula-dir JobId 187: Fatal error: bsock.c:135 Unable to connect to
Storage daemon on 148.251.233.188:9103. ERR=Connection refused
12-Sep 23:35 bacula-dir JobId 187: Error: Bacula bacula-dir 5.0.0 (26Jan10): 12-
Sep-2014 23:35:06
Build OS: x86_64-redhat-linux-gnu redhat
JobId: 187
Job: BackupClient1.2014-09-12_23.05.00_03
Backup Level: Full (upgraded from Incremental)
Client: “bacula-fd-newproxy2”
FileSet: “Full Set” 2014-07-09 22:16:42
Pool: “File” (From Job resource)
Catalog: “MyCatalog” (From Client resource)
Storage: “File” (From Job resource)
Scheduled time: 12-Sep-2014 23:05:00
Start time: 12-Sep-2014 23:05:02
End time: 12-Sep-2014 23:35:06
Elapsed time: 30 mins 4 secs
Priority: 10
FD Files Written: 0
SD Files Written: 0
FD Bytes Written: 0 (0 B)
SD Bytes Written: 0 (0 B)
Rate: 0.0 KB/s
Software Compression: None
VSS: no
Encryption: no
Accurate: no
Volume name(s):
Volume Session Id: 0
Volume Session Time: 0
Last Volume Bytes: 0 (0 B)
Non-fatal FD errors: 0
SD Errors: 0
FD termination status:
SD termination status:
Termination: *** Backup Error ***12-Sep 23:35 bacula-dir JobId 188: shell command: run BeforeJob “/usr/libexec/ba
cula/make_catalog_backup.pl MyCatalog”
12-Sep 23:35 bacula-dir JobId 188: Start Backup JobId 188, Job=BackupCatalog.201
4-09-12_23.10.00_04
12-Sep 23:35 bacula-dir JobId 188: Warning: bsock.c:129 Could not connect to Sto
rage daemon on 148.251.233.188:9103. ERR=Connection refused
Retrying …
12-Sep 23:40 bacula-dir JobId 188: Warning: bsock.c:129 Could not connect to Sto
rage daemon on 148.251.233.188:9103. ERR=Connection refused
Retrying …
12-Sep 23:45 bacula-dir JobId 188: Warning: bsock.c:129 Could not connect to Sto
rage daemon on 148.251.233.188:9103. ERR=Connection refused
Retrying …
12-Sep 23:50 bacula-dir JobId 188: Warning: bsock.c:129 Could not connect to Sto
rage daemon on 148.251.233.188:9103. ERR=Connection refused
Retrying …
12-Sep 23:55 bacula-dir JobId 188: Warning: bsock.c:129 Could not connect to Sto
rage daemon on 148.251.233.188:9103. ERR=Connection refused
Retrying …
13-Sep 00:01 bacula-dir JobId 188: Warning: bsock.c:129 Could not connect to Sto
rage daemon on 148.251.233.188:9103. ERR=Connection refused
Retrying …
13-Sep 00:05 bacula-dir JobId 188: Fatal error: bsock.c:135 Unable to connect to
Storage daemon on 148.251.233.188:9103. ERR=Connection refused
13-Sep 00:05 bacula-dir JobId 188: Error: Bacula bacula-dir 5.0.0 (26Jan10): 13-
Sep-2014 00:05:17
Build OS: x86_64-redhat-linux-gnu redhat
JobId: 188
Job: BackupCatalog.2014-09-12_23.10.00_04
Backup Level: Full
Client: “bacula-fd-newproxy2”
FileSet: “Catalog” 2014-06-13 23:10:00
Pool: “File” (From Job resource)
Catalog: “MyCatalog” (From Client resource)
Storage: “File” (From Job resource)
Scheduled time: 12-Sep-2014 23:10:00
Start time: 12-Sep-2014 23:35:09
End time: 13-Sep-2014 00:05:17
Elapsed time: 30 mins 8 secs
Priority: 11
FD Files Written: 0
SD Files Written: 0
FD Bytes Written: 0 (0 B)
SD Bytes Written: 0 (0 B)
Rate: 0.0 KB/s
Software Compression: None
VSS: no
Encryption: no
Accurate: no
Volume name(s):
Volume Session Id: 0
Volume Session Time: 0
Last Volume Bytes: 0 (0 B)
Non-fatal FD errors: 0
SD Errors: 0
FD termination status:
SD termination status:
Termination: *** Backup Error ****
*
*
*lable
lable: is an invalid command.
*label
Automatically selected Storage: File
Enter new Volume name: NewProxy2-20140913-01
Defined Pools:
1: Default
2: File
3: Scratch
Select the Pool (1-3): 2
Connecting to Storage daemon File at 148.251.233.188:9103 …
Sending label command for Volume “NewProxy2-20140913-01” Slot 0 …
3910 Unable to open device “”FileStorage” (/mnt)”: ERR=dev.c:575 Could not open: /mnt/NewProxy2-20140913-01, ERR=Permiss
ion deniedLabel command failed for Volume NewProxy2-20140913-01.
Do not forget to mount the drive!!!
*label
Automatically selected Storage: File
Enter new Volume name: NewProxy2-20140913-01
Defined Pools:
1: Default
2: File
3: Scratch
Select the Pool (1-3): 2
Connecting to Storage daemon File at 148.251.233.188:9103 …
Sending label command for Volume “NewProxy2-20140913-01″ Slot 0 …
3000 OK label. VolBytes=213 DVD=0 Volume=”NewProxy2-20140913-01″ Device=”FileStorage” (/tmp)
Catalog record for Volume “NewProxy2-20140913-01”, Slot 0 successfully created.
Requesting to mount FileStorage …
3906 File device “”FileStorage” (/tmp)” is always mounted.
*run
A job name must be specified.
The defined Job resources are:
1: BackupClient1
2: BackupCatalog
3: RestoreFiles
Select Job resource (1-3): 1
Run Backup job
JobName: BackupClient1
Level: Incremental
Client: bacula-fd-newproxy2
FileSet: Full Set
Pool: File (From Job resource)
Storage: File (From Job resource)
When: 2014-09-13 07:37:00
Priority: 10
OK to run? (yes/mod/no): yes
Job queued. JobId=189
You have messages.
*
13-Sep 07:37 bacula-dir JobId 189: No prior Full backup Job record found.
13-Sep 07:37 bacula-dir JobId 189: No prior or suitable Full backup found in catalog. Doing FULL backup.
13-Sep 07:37 bacula-dir JobId 189: Start Backup JobId 189, Job=BackupClient1.2014-09-13_07.37.18_06
13-Sep 07:37 bacula-dir JobId 189: Fatal error: Storage daemon rejected Job command: 3915 Bad Job command. stat=-1 CMD:
JobId=189 job=BackupClient1.2014-09-13_07.37.18_06 job_name=BackupClient1 client_name=bacula-fd-newproxy2 type=66 level=
70 FileSet=FullSet NoAttr=0 SpoolAttr=0 FileSetMD5=x5/nrxgn2Udnjg/zy68AHC SpoolData=0 WritePartAfterJob=1 PreferMountedV
ols=1 SpoolSize=0 Resched=-110924928
13-Sep 07:37 bacula-dir JobId 189: Error: Bacula bacula-dir 5.0.0 (26Jan10): 13-Sep-2014 07:37:20
Build OS: x86_64-redhat-linux-gnu redhat
JobId: 189
Job: BackupClient1.2014-09-13_07.37.18_06
Backup Level: Full (upgraded from Incremental)
Client: “bacula-fd-newproxy2”
FileSet: “Full Set” 2014-07-09 22:16:42
Pool: “File” (From Job resource)
Catalog: “MyCatalog” (From Client resource)
Storage: “File” (From Job resource)
Scheduled time: 13-Sep-2014 07:37:00
Start time: 13-Sep-2014 07:37:20
End time: 13-Sep-2014 07:37:20
Elapsed time: 0 secs
Priority: 10
FD Files Written: 0
SD Files Written: 0
FD Bytes Written: 0 (0 B)
SD Bytes Written: 0 (0 B)
Rate: 0.0 KB/s
Software Compression: None
VSS: no
Encryption: no
Accurate: no
Volume name(s):
Volume Session Id: 0
Volume Session Time: 0
Last Volume Bytes: 0 (0 B)
Non-fatal FD errors: 0
SD Errors: 0
FD termination status:
SD termination status:
Termination: *** Backup Error ****[root@proxy ~]# ^C
[root@proxy ~]# ^C
[root@proxy ~]#
Run restore: http://www.server-world.info/en/note?os=CentOS_6&p=bacula&f=5
GUI: http://www.server-world.info/en/note?os=CentOS_6&p=bacula&f=6
https://sites.google.com/site/ryanmelissari/home/bacula-5212-with-bat-on-centos-63
收集的一些FreeNAS上用bacula-sd的资料如下:
bacula-sd-plugin
http://forums.freenas.org/index.php?threads/bacula-sd-plugin.8212/
https://github.com/williambr/freenas-bacula
Versions
Bacula SD 5.2.6_0.1-BETA2
x64 – http://www.filefactory.com/file/6j9lg1ctlkvv/n/bacula-sd-5_2_6-amd64_0_1-BETA2_pbi
x86 – http://www.filefactory.com/file/4e7wpt3xez2d/n/bacula-sd-5_2_6-i386_0_1-BETA2_pbi
root@bacula-sd_1:/ # /usr/local/etc/rc.d/bacula-sd start
Starting bacula_sd.root@bacula-sd_1:/mnt # /usr/local/etc/rc.d/bacula-sd stop
Stopping bacula_sd.http://www.xpd259.co.uk/2014/03/bacula-backup-with-freenas-as-storage.html
sd reject: different version
https://groups.google.com/forum/#!topic/bareos-users/Siu0FFDHC5c
/usr/local/etc/rc.d/bacula-sd restarthttp://www.freebsddiary.org/bacula.php
bacula_dir_enable=”YES”
bacula_sd_enable=”YES”
#bacula_fd_enable=”YES”usr/pbi/bacula-sd-amd64/etc/rc.d
/usr/local/etc/rc.d/bacula-dir start /usr/local/sbin/bacula-dir -f -d 100
/usr/local/etc/rc.d/bacula-sd start
#/usr/local/etc/rc.d/bacula-fd start
http://www.linuxjournal.com/magazine/backups-future-eliminate-tape-backups-freenas-and-bacula?page=0,1
http://www.openlogic.com/wazi/bid/345617/Expand-FreeNAS-with-plugins
https://bugs.freenas.org/issues/1419
http://forums.freenas.org/index.php?threads/installing-bacula-fd-on-freenas.12421/
http://forums.freenas.org/index.php?threads/best-backup-solution-over-external-network.18644/
http://www.freebsddiary.org/bacula.php
http://forums.freenas.org/index.php?threads/howto-install-bacula-with-sqlite-support-and-a-dell-powervault-124t.5547/
https://github.com/williambr/freenas-bacula/blob/master/nanobsd/plugins/bacula_pbi/resources/bacula
http://ports.su/sysutils/bacula,sqlite3,-server
http://www.bacula.org/2.4.x-manuals/en/main/Installin_Configuri_SQLite.html
其他的一些资料比如WebGUI等:
Web
http://www.bacula-web.org/download.htmlUbuntu:
https://help.ubuntu.com/10.04/serverguide/bacula.htmlBareOS
http://www.bareos.org/http://www.freebsddiary.org/bacula.php
总体感觉跟现在的云端的备份恢复比起来比较费时和负责,不过还是记录一下。


