bacula是一个很不错的备份软件,自rhel6 加入了官方仓库中,据说facebook就用它来备份数据。
bacula分为三大部分,服务端dir、存储端sd、客户端。
服务端是bacula的中枢神经,负责验证客户端,定制备份计划和执行备份任务;
存储端仅仅提供存储介质,可以是硬盘,磁带,光盘等;
客户端功能也很简单,主要提供文件备份时的上传和还原时的下载;
由三大部分衍生出来的功能还有bconsole、bat,分别提供了服务端的命令行接口和图形接口。webmin还提供了一个强大的基于web的配置界面。
提供一个自己写的脚本,快速搭建bacula服务器。
- #!/usr/bin/env bash
- # name=bacula_setup.sh
- # author:purple_grape
- # version: 0.6
- # this script will create a ready-to-run bacula server
- # test under scientific linux 6.1 only , use it at your own risk
- #-------------------------------------------------------#
- #set -x
- set -e
- if [ "$(id -u)" != "0" ]; then
- echo "This script must be run as root" 1>&2
- exit 1
- fi
- # install packages
- yum -y install bacula-director-mysql bacula-storage-mysql bacula-console bacula-client mysql-server # bacula-console-bat bacula-docs
- #the last 2 packages are optional,you may need them under a GUI
- rpm -ivh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
- yum install pwgen --enablerepo=epel -y
- # ip=`ifconfig eth0 |grep "inet addr" |awk '{print $2}'|cut -c 6-`
- addr=192.168.1.251
- #pwgen is a passwd generator!!
- dirpw=`pwgen -B 20 1`
- mondirpw=`pwgen -B 20 1`
- sdpw=`pwgen -B 20 1`
- monsdpw=`pwgen -B 20 1`
- fdpw=`pwgen -B 20 1`
- monfdpw=`pwgen -B 20 1`
- sed -i.bak ' s/\@\@DIR_PASSWORD\@\@/'$dirpw'/g; s/\@\@SD_PASSWORD\@\@/'$sdpw'/g; s/\@\@FD_PASSWORD\@\@/'$fdpw'/g; s/\@\@MON_DIR_PASSWORD\@\@/'$mondirpw'/g; s/client\.example\.com/'$addr'/g;s/storage\.example\.com/'$addr'/g' /etc/bacula/bacula-dir.conf
- sed -i.bak ' s/\@\@SD_PASSWORD\@\@/'$sdpw'/g ;s/\@\@MON_SD_PASSWORD\@\@/'$monsdpw'/g' /etc/bacula/bacula-sd.conf
- sed -i.bak ' s/\@\@FD_PASSWORD\@\@/'$fdpw'/g ;s/\@\@MON_FD_PASSWORD\@\@/'$dirpw'/g' /etc/bacula/bacula-fd.conf
- sed -i.bak ' s/\@\@DIR_PASSWORD\@\@/'$dirpw'/g;s/localhost/'$addr'/g' /etc/bacula/bconsole.conf
- sed -i.bak ' s/\@\@DIR_PASSWORD\@\@/'$dirpw'/g;s/server\.example\.com/'$addr'/g' /etc/bacula/bat.conf
- sed -i '/50G/i\ Label Format = "test-"' /etc/bacula/bacula-dir.conf
- sed -i '/test-/i\ Maximum Volume Jobs =1' /etc/bacula/bacula-dir.conf
- # mail out when get error only
- sed -i '/root\@localhost/{s/mail/MailOnError/}' /etc/bacula/bacula-dir.conf
- echo DIR_PASSWORD $dirpw >/etc/bacula/password
- echo MON_DIR_PASSWROD $mondirpw >>/etc/bacula/password
- echo SD_PASSWROD $sdpw >>/etc/bacula/password
- echo MON_SD_PASSWROD $monsdpw >>/etc/bacula/password
- echo FD_PASSWORD $fdpw >>/etc/bacula/password
- echo MON_FD_PASSWROD $monfdpw >>/etc/bacula/password
- chmod 600 /etc/bacula/password
- # initial mysql
- /etc/init.d/mysqld restart
- chkconfig --level 2345 mysqld on
- # empty passwd is default in newly-installed mysql server,
- # if you have set your own passwd
- # please add "-p" at the end of the following command
- /usr/libexec/bacula/grant_mysql_privileges
- /usr/libexec/bacula/create_mysql_database
- /usr/libexec/bacula/make_mysql_tables
- # restart services and set them on-boot
- /etc/init.d/bacula-dir restart
- /etc/init.d/bacula-fd restart
- /etc/init.d/bacula-sd restart
- chkconfig --level 2345 bacula-dir on
- chkconfig --level 2345 bacula-fd on
- chkconfig --level 2345 bacula-sd on
- # the end
本文转自 紫色葡萄 51CTO博客,原文链接:http://blog.51cto.com/purplegrape/933802,如需转载请自行联系原作者