Bacula backup solution.

Computer/Linux June 8th, 2010 12:38 kage | PDF 저장
2006년도에 SK쪽에 개발 해주기위해 살펴보고 선정해서 작업했던 Bacula-1.38.11 backukp solution이 벌써 5.x의 버전으로 올라왔다. 그외에 좋은 기능들이 많이 생겼다.

이때는 사용이 편하고 적당한 기능에 opensource를 선정하다보니 bacula를 선정했었는데....

현재는 linux, unix, windows까지 모두 지원한다.
예전에 삽질을 많이 하면서 분석해서 업그래이드해서 만든 툴이 있었는데... 문제는 별로 documantation을 해두지 않아서 지금 다시 하려니 쩝... 난감하다. 그래서 이번엔 documantaion을 잘 해두려고 한다.

bacula를 설치하기위해서는 다음 몇가지가 필요하다. ( bin & devel package )
readline package
mysql package ( 다른 DB package여도 된다.)
  - mysql server를 위해 perl-DBD-MySQL package도 필요
python package

start mysql daemon

[] Bacula-5.0.2 install

download : http://www.bacula.org

extract : tar zxvf bacula-x.x.x.tar.gz

configure : ./configure  --prefix=/usr/local/bacula-5.0.2 --with-x --with-mysql --with-readline --with-python --with-db-password=BACULA_PWD --with-db-port=3306 --enable-includes  --enable-bwx-console --enable-static --enable-shared

mysql port is 3306.

make : make

install : make install

환경설정하기 : bacula server
cd /usr/local/bacula-5.0.2/etc
#환경설정 했던것을 다시한번 보고 싶을때
./bacula_config
#create bacula database to mysql
./create_bacula_datase
#create bacula table to mysql
./make_bacula_tables
#copy from <bacula source>/examples/sample-query.sql to /usr/local/bacula-5.0.2/etc/query.sql
cp /root/bacula-5.0.2/examples/sample-query.sql to /usr/local/bacula-5.0.2/etc/query.sql


checking /etc/service
[root@backup bacula-5.0.2]# cat /etc/services |grep bacula
bacula-dir      9101/tcp                        # Bacula Director
bacula-dir      9101/udp                        # Bacula Director
bacula-fd       9102/tcp                        # Bacula File Daemon
bacula-fd       9102/udp                        # Bacula File Daemon
bacula-sd       9103/tcp                        # Bacula Storage Daemon
bacula-sd       9103/udp                        # Bacula Storage Daemon


run : cd /usr/local/bacula-5.0.2/sbin
        ./bacula start
        ./console  (or ./gnome-console)

stop : ./bacula stop


checking bacula stuff
# ps -ef |grep bacula
root      2040     1  0 22:32 ?        00:00:00 /usr/local/bacula-5.0.2/sbin/bacula-sd -v -c /usr/local/bacula-5.0.2/etc/bacula-sd.conf
root      2050     1  0 22:32 ?        00:00:00 /usr/local/bacula-5.0.2/sbin/bacula-fd -v -c /usr/local/bacula-5.0.2/etc/bacula-fd.conf
root      2058     1  0 22:32 ?        00:00:00 /usr/local/bacula-5.0.2/sbin/bacula-dir -v -c /usr/local/bacula-5.0.2/etc/bacula-dir.conf
# netstat -na |grep 910
tcp        0      0 0.0.0.0:9102                0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:9103                0.0.0.0:*                   LISTEN    
# ./bacula status
bacula-sd (pid 18753) is running...
bacula-fd (pid 18763) is running...
bacula-dir (pid 18771) is running...
그러나 bconsole을 띄우면 bacula-dir 데몬이 죽게된다. 그래서 netstat로 9101 포트가 살아 있는지 확인을 꼭해야 한다.
# ./bacula status
bacula-sd (pid 2040) is running...
bacula-fd (pid 2050) is running...
bacula-dir dead but pid file exists

이것은 대게 mysql과 bacula와 연동이 안되서 생기는 증상이다.
# ./bacula stop

# mysql
mysql> use mysql
mysql> insert into user (host,user,password) values('localhost','bacula',password('BACULA_PWD'));
mysql> insert into db values('%','bacula','bacula','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');


[root@backup etc]# ./bacula start
Starting the Bacula Storage daemon
Starting the Bacula File daemon
Starting the Bacula Director daemon
[root@backup etc]# ps -ef |grep bacu
root     19144     1  0 23:13 ?        00:00:00 /usr/local/bacula-5.0.2/sbin/bacula-sd -v -c /usr/local/bacula-5.0.2/etc/bacula-sd.conf
root     19154     1  0 23:13 ?        00:00:00 /usr/local/bacula-5.0.2/sbin/bacula-fd -v -c /usr/local/bacula-5.0.2/etc/bacula-fd.conf
root     19162     1  0 23:13 ?        00:00:00 /usr/local/bacula-5.0.2/sbin/bacula-dir -v -c /usr/local/bacula-5.0.2/etc/bacula-dir.conf
root     19168  1045  0 23:13 pts/2    00:00:00 grep bacu
[root@backup etc]# netstat -na |grep 910
tcp        0      0 0.0.0.0:9101                0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:9102                0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:9103                0.0.0.0:*                   LISTEN     

[root@backup etc]# cd ../sbin
[root@backup sbin]# ls
bacula      bacula-fd  bconsole  bextract  bregex  bsmtp  btraceback  dbcheck
bacula-dir  bacula-sd  bcopy     bls       bscan   btape  bwild
[root@backup sbin]# ./bconsole
Connecting to Director backup:9101
1000 OK: backup-dir Version: 5.0.2 (28 April 2010)
Enter a period to cancel a command.
*

Test backup
[root@backup etc]# pwd
/usr/local/bacula-5.0.2/etc
# vi file-list
--------------------------------------------------------
/usr/local/bacula-5.0.2/share/man/man1/bacula-bwxconsole.1.gz
/usr/local/bacula-5.0.2/share/man/man1/bacula-tray-monitor.1.gz
--------------------------------------------------------
# bacula-fd.conf 는 backup 될곳(client)에 떠 있는 daemon의 환경설정파일. (client server)
# vi bacula-dir.conf    (backup server)
backup 할 곳(client) 정의 및 backup 서버를 정의한다.
--------------------------------------------------------
# List of files to be backed up
FileSet {
  Name = "Full Set"
  Include {
    Options {
      signature = MD5
    }
#
#  Put your list of files here, preceded by 'File =', one per line
#    or include an external list with:
#
#    File = <file-name
#
#  Note: / backs up everything on the root partition.
#    if you have other partitions such as /usr or /home
#    you will probably want to add them too.
#
#  By default this is defined to point to the Bacula binary
#    directory to give a reasonable FileSet to backup to
#    disk storage during initial testing.
#
    #File = /usr/local/bacula-5.0.2/sbin
    File = </usr/local/bacula-5.0.2/etc/file-list #<= backup file list
  }
 
#
# If you backup the root directory, the following two excluded
#   files can be useful
#
  Exclude {
    File = /usr/local/bacula-5.0.2/var/bacula/working
    File = /tmp
    File = /proc
    File = /tmp
    File = /.journal
    File = /.fsck
  }
}
--------------------------------------------------------------
# vi bacula-sd.conf     ( backukp server )
backup파일이 쌓일 storage 관련 정보를 지정해준다.
--------------------------------------------------------------
Device {
  Name = FileStorage
  Media Type = File
#  Archive Device = /tmp
  Archive Device = /backup/bacula  # <= backup 된 디렉토리를 써준다.
  LabelMedia = yes;                   # lets Bacula label unlabeled media
  Random Access = Yes;
  AutomaticMount = yes;               # when device opened, read it
  RemovableMedia = no;
  AlwaysOpen = no;
}
--------------------------------------------------------------

[root@backup etc]# ./bconsole
Connecting to Director backup:9101
1000 OK: backup-dir Version: 5.0.2 (28 April 2010)
Enter a period to cancel a command.
* label
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
Automatically selected Storage: File
Enter new Volume name: test2
Defined Pools:
     1: Default
     2: File
     3: Scratch
Select the Pool (1-3): 2
Connecting to Storage daemon File at backup:9103 ...
Sending label command for Volume "test2" Slot 0 ...
3000 OK label. VolBytes=186 DVD=0 Volume="test2" Device="FileStorage" (/backup/bacula)
Catalog record for Volume "test2", Slot 0  successfully created.
Requesting to mount FileStorage ...
3906 File device "FileStorage" (/backup/bacula) is always mounted.
*

이렇게 label 명령어로 백업 시킬 device (file name)을 생성시킨후에 run 명령어로 백업하면 백업될곳의 내용이 label로 정의 한 파일에 저장된다.



[] bacula daemon 설명
bacula director (bacula-dir)
   - backup, restore 등의 작업을 총괄하는 서비스
   - backup schedule을 관리
bacula console (console)
   - 관리자가 명령어를 입력하는 콘솔 (director에 접속할수 있어야함)
   - bwx-console은 GUI 환경의 console
bacula file (bacula-fd)
    - 백업할 곳의 장비에 설치되는 서비스
    - director로부터 명령어를 받아서 backup 하거나 restore를 해준다.
    - restore를 할때 다른곳으로도 보내서 restore가 가능하다.
bacula storage (bacula-sd)
    - backup device를 갖고 있는 장비에 설치되는 서비스
    - bacula-fd로부터 날아오는 파일을 저장 하거나
       backup된 것으로부터 bacula-fd로 데이터를 날려주는 daemon
    - directory에 file device를 사용하거나 DVD, DLT, 8mm, 4mm 등의 device 정의
    - director로부터 명령어를 받아 처리함.
Catalog
    - 백업되는 파일들의 정보가 저장되는 데이터베이스 머신에 설치되는 서비스
    - 이것이 깨진경우 백업파일이 직접 접근할수 있는 유틸을 사용가능
bacula monitor
    - 여러 버시스들의 상태를 알수 있는 GUI 프로그램
크리에이티브 커먼즈 라이센스
Creative Commons License
TAG ,
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://www.cep.kr/blog/cep/rss/response/239

댓글+트랙백 ATOM :: http://www.cep.kr/blog/cep/atom/response/239

트랙백 주소 :: http://www.cep.kr/blog/cep/trackback/239

트랙백 RSS :: http://www.cep.kr/blog/cep/rss/trackback/239

트랙백 ATOM :: http://www.cep.kr/blog/cep/atom/trackback/239

댓글을 달아 주세요

댓글 RSS 주소 : http://www.cep.kr/blog/cep/rss/comment/239
댓글 ATOM 주소 : http://www.cep.kr/blog/cep/atom/comment/239