Saturday, February 11, 2012

Using the online backup system bacula Environment


To install bacula then a few are needed. (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
# Once again, I did report preference sipeulttae
. / Bacula_config
#create bacula database to mysql
. / Create_bacula_datase
#create bacula table to mysql
./make_bacula_tables
#copy from /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...
However, the ttuiwoomyeon bconsole bacula-dir daemon is killed. So as netstat, verify that port 9101 must be submitted.
#. / Bacula status
bacula-sd (pid 2040) is running...
bacula-fd (pid 2050) is running...
bacula-dir dead but pid file exists

This usually works with mysql and bacula are symptoms caused are impossible.
#. / 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-backup fd.conf 는 될곳 (client) 에 떠 있는 daemon 의 환경 설정 파일. (Client server)
# Vi bacula-dir.conf (backup server)
Where to backup (client) is defined definitions and backup servers.
--------------------------------------------------------
# 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 =
#
#  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 =
  }
#
# 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)
accumulate backup file storage-related information to be indicated.
--------------------------------------------------------------
Device {
  Name = FileStorage
  Media Type = File
#  Archive Device = /tmp
  Archive Device = /backup/bacula  # <= backup 된 디렉토리를 써준다.
  LabelMedia = yes; # lets Bacula label unlabeled half
  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.
*

Backup command to label this as a device (file name) to run commands to create a backup sikinhu where the backup will be defined as the contents of the label is stored in a file.



[] Bacula daemon 설명
bacula director (bacula-dir)
   - Backup, restore and general manager of service operations such as
   - backup schedule을 관리
bacula console (console)
   - Administrator console to enter commands (director iteoyaham I access)
   - Console-BWX 은 환경 의 GUI console
bacula file (bacula-fd)
    - Back up service where the equipment is installed in
    - director로부터 명령어를 받아서 backup 하거나 restore를 해준다.
    - Restore and elsewhere, as when you send a restore is possible.
bacula storage (bacula-sd)
    - Backup device that is installed in equipment, services that have
    - Bacula-fd or save a file from a flying
       to backup the data to a blow from the bacula-fd a daemon
    - directory에 file device를 사용하거나 DVD, DLT, 8mm, 4mm 등의 device 정의
    - Director cheoriham accept commands from.
Catalog
    - The backup of the file that stores information services that are installed on the database machine
    - If this is broken backup file can be accessed directly using the utilities
bacula monitor
    - I find out the status of several privacy GUI program off