在 lab100主機( bacula Server)備份資料庫
vi /usr/local/bacula/etc/bacula-dir.conf

# mysql
  Job {
  Name = "bac-lab100-mysql"
  Type = "Backup"
  Level = Full
  Client = "lab100-fd"
  FileSet="mysql-all-lab100"
  Schedule = "WeeklyCycle"
  Storage = "bac-file-lab100"
  Messages = "Standard"
  Pool = "Default"
  RunBeforeJob = "/usr/local/bacula//etc/make_mysqldump_all.sh bacuser bacuser mysqldump-all-lab100"
  RunAfterJob = "/usr/local/bacula//etc/delete_mysqldump_file.sh   mysqldump-all-lab100"
  Write Bootstrap = "/usr/local/bacula//var/bacula/working/lab100-mysql.bsr"
  Priority = 12
}

FileSet {
  Name = "mysql-all-lab100"
  Include {
               Options {
                             signature = MD5
                             compression=GZIP
               }
  File = /usr/local/bacula//var/bacula/working/mysqldump-all-lab100.sql
  }
}

# postgresql
Job {
  Name = "bac-lab100-postgresql"
  Type = "Backup"
  Level = Full
  Client = "lab100-fd"
  FileSet="postgresql-lab100"
  Schedule = "WeeklyCycle"
  Storage = "bac-file-lab100"
  Messages = "Standard"
  Pool = "Default"
  RunBeforeJob = "/usr/local/bacula//etc/make_pgdump.sh"
  RunAfterJob = "/usr/local/bacula//etc/delete_pgdump_file.sh"
  Write Bootstrap = "/usr/local/bacula//var/bacula/working/lab100-postgresql.bsr"
  Priority = 12
}

FileSet {
  Name = "postgresql-lab100"
  Include {
               Options {
                             signature = MD5
                             compression=GZIP
                }
  File = /usr/local/bacula//var/bacula/working/pgdump-lab100-smoc.sql
  File = /usr/local/bacula//var/bacula/working/pgdump-lab100-interchannel.sql
  File = /usr/local/bacula//var/bacula/working/pgdump-lab100-sendmail-sig.sql
  }
}

vi /usr/local/bacula/etc/make_mysqldump_all.sh

#!/bin/sh
# 2006/11/01 fixed by [email protected]
#
cd /usr/local/bacula//var/bacula/working
/usr/local/mysql//bin/mysqldump -u $1 -p$2 -f –opt -A > $3.sql

vi /usr/local/bacula/etc/make_pgdump.sh

#!/bin/sh
# 2006/11/01 fixed by [email protected]
#
cd /usr/local/bacula//var/bacula/working
pgdump="/usr/bin/pg_dump"
$pgdump interchannel -U icmanager > pgdump-lab100-interchannel.sql
$pgdump sendmail_sig -U postgres > pgdump-lab100-sendmail-sig.sql
$pgdump smoc_tmp -U smoc > pgdump-lab100-smoc.sql

vi /usr/local/bacula/etc/delete_mysqldump_file.sh

#!/bin/sh
# 2006/11/01 fixed by [email protected]
#
rm -f /usr/local/bacula//var/bacula/working/$1*.sql

vi /usr/local/bacula/etc/delete_pgdump_file.sh

#!/bin/sh
# 2006/11/01 fixed by [email protected]
#
rm -f /usr/local/bacula//var/bacula/working/pgdump*.sql
Related posts 相關文章
備份 VSCode 設定
More...
Linux 救援光碟 SystemRescueCd,支援Windows,也可以遠端備份還原
More...
使用 mondo 線上備份linux centos 系統
More...
linux 的 dd + nc 線上備份主機硬碟
More...

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。