1、配置备份
cd /data/cluster/kingbase/share
vi sys_backup.conf
# target db style enum: single/cluster
_target_db_style="single"
# one kingbase node IP
# just provide one IP, script will use 'repmgr cluster show' get other node IP
_one_db_ip="10.1.56.139"
# local repo IP, inner-REPO, must be same as one_db_ip, means repo located in one db node
# outer repo IP, outer-REPO, means repo located in outer node
_repo_ip="10.1.56.135"
# label of this cluster
_stanza_name="kingbase"
# OS user name of database
_os_user_name="kingbase"
# !!!! dir to store the backup files
# should be accessable for the OS user
_repo_path="/data/backup_rman/kbbr_repo"#备份集目录,kbbr_repo这个之前的路径随意,这个是必须存在的
# count of keep, over the count FULL-backup will be remove
_repo_retention_full_count=5
# count of days, interval to do FULL-backup
_crond_full_days=7
# count of days, interval to do DIFF-backup
_crond_diff_days=0
# count of days, interval to do INCR-backup
_crond_incr_days=1
# HOUR to do the FULL-backup
_crond_full_hour=2
# HOUR to do the DIFF-backup
_crond_diff_hour=3
# HOUR to do the INCR-backup
_crond_incr_hour=4
# OS cmd define
_os_ip_cmd="/usr/sbin/ip"
_os_rm_cmd="/usr/bin/rm"
_os_sed_cmd="/usr/bin/sed"
_os_grep_cmd="/usr/bin/grep"
# !!! these follow 4 parameter ONLY for single style
# data dir of single
_single_data_dir="/data/data" #data路径
# bin dir of single
_single_bin_dir="/home/kingbase/cluster/kingbase/bin"在使用sys_rman命令时需要
# database user of single
_single_db_user="system"
# database port of single
_single_db_port="54321"
保存退出
2、初始化备份目录
cd /data/cluster/kingbase/bin
./sys_backup.sh init
3、开启物理备份
sys_backup.sh start(在/etc/cron.d/KINGBASECRON定时任务中配置定时任务)
4、关闭物理备份
sys_backup.sh stop(在/etc/cron.d/KINGBASECRON定时任务中删除定时任务)
5、暂时停止定时备份
sys_backup.sh pause 不影响已经在进行中的备份动作
6、恢复被暂停的定时备份
sys_backup.sh unpause
0 2 */7 * * kingbase /home/kingbase/cluster/kingbase/bin/sys_rman --config=/data/backup_rman/kbbr_repo/sys_rman.conf --stanza=kingbase --archive-copy --type=full backup >> /home/kingbase/cluster/kingbase/log/sys_rman_backup_full.log 2>&1
每周第七天凌晨2点进行全被
0 4 */1 * * kingbase /home/kingbase/cluster/kingbase/bin/sys_rman --config=/data/backup_rman/kbbr_repo/sys_rman.conf --stanza=kingbase --archive-copy --type=incr backup >> /home/kingbase/cluster/kingbase/log/sys_rman_backup_incr.log 2>&1
每天凌晨4点进行增量备份