- 物理备份
数据库开启归档模式
(1)修改配置文件kingbase.conf中参数:
archive_mode=on
archive_command=’’
(2)重启数据库在Sever/bin下执行命令
[kingbase@node2 bin]$ sys_ctl restart -D /home/kingbase/KingbaseES/V8/data
修改物理备份配置文件/home/kingbase/Kingbas/ES/Server/share/
vi /home/kingbase/KingbaseES/V8/Server/share/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="192.168.114.13" --本机物理IP
# 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="192.168.114.13" --本机物理IP,与_one_db_ip配置相同
# 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="/home/kingbase/kbbr_repo" --备份路径
# count of keep, over the count FULL-backup will be remove
_repo_retention_full_count=5 --全量备份保留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="/bin/rm"
_os_sed_cmd="/bin/sed"
_os_grep_cmd="/bin/grep"
# !!! these follow 4 parameter ONLY for single style
# data dir of single
_single_data_dir="/home/kingbase/Kingbase/ES/V8/data"
# bin dir of single
_single_bin_dir="/home/kingbase/Kingbase/ES/V8/Server/bin"
#_single_bin_dir="/home/kingbase/Kingbase/ES/V8/Server/bin"
# database user of single
_single_db_user="system"
# database port of single
_single_db_port="54321"
_use_scmd=off
执行sys_backup.sh init备份初始化
cd /home/kingbase/Kingbase/ES/V8/Server/bin/
./sys_backup.sh init
——执行后会在备份文件路径 /home/kingbase/kbbr_repo 创建文件夹、文件、配置文件等,并备份一次全量数据。
添加定时任务/Server/bin下执行sh sys_backup.sh start
查看定时任务cat /etc/cron.d/KINGBASECRON