人大金仓开启备份策略

支持客户 开启 人大金仓 7天全备 策略

开启归档

首先开启归档, 需要修改 /opt/Kingbase/ES/V8/data 目录下配置文件 kingbase.conf 中的 archive mode archive cormand 参数,修改完该参数之后要 重启数据库 才能生效,

archive_mode = on
archive_command = ' '

人大金仓开启备份策略_第1张图片

su - kingbase    --切换到kingbase模式
cd /opt/Kingbase/ES/V8/Server/bin  --进入这个目录
./sys_ctl -D /opt/Kingbase/ES/V8/data restart  --重启命令  

修改备份配置文件

修改 /opt/Kingbase/ES/V8/Server/share 下的 sys_backup.conf,

人大金仓开启备份策略_第2张图片

由于是 单机 模式,七天全备策略,相关参数 需要按图中修改·

服务器,备份路径信息

_target_db_style="single"    ---单机模式


_one_db_ip="10.0.0.101"
_repo_ip="10.0.0.101"         ---单机模式 两个参数 IP 一致


_repo_path="/home/kingbase/kbbr_repo"    ---备份路径

备份测率信息

# count of keep, over the count FULL-backup will be remove
_repo_retention_full_count=7
# count of days, interval to do FULL-backup
_crond_full_days=1
# count of days, interval to do DIFF-backup
_crond_diff_days=0
# count of days, interval to do INCR-backup
_crond_incr_days=0
# 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
# band witdh limit, fixed in Mb/s, default 0 means no limit
_band_width=0

完整 sys_back.conf 备份文件信息

#file: sys_backup.conf
#dest dir: /kingbase/bin/sys_backup.conf
#dest dir: /kingbase/share/sys_backup.conf


# target db style enum:  single/cluster/single-pro
_target_db_style="single"
# one kingbase node IP/hostname
# just provide one IP/hostname, script will use 'repmgr cluster show' get other node IP/hostname
_one_db_ip="10.0.0.101"
# local repo IP/hostname, inner-REPO, means repo located in one db node
# outer repo IP/hostname, outer-REPO, means repo located in outer node
_repo_ip="10.0.0.101"
# 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=7
# count of days, interval to do FULL-backup
_crond_full_days=1
# count of days, interval to do DIFF-backup
_crond_diff_days=0
# count of days, interval to do INCR-backup
_crond_incr_days=0
# 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
# band witdh limit, fixed in Mb/s, default 0 means no limit
_band_width=0
# OS cmd define
_os_ip_cmd="/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="/opt/Kingbase/ES/V8/data"
# bin dir of single
_single_bin_dir="/opt/Kingbase/ES/V8/Server/bin"
# database user of single
_single_db_user="system"
# database port of single
_single_db_port="54321"


# on means sys_securecmd, off means normal ssh
_use_scmd=on


# whether to sys_start_backup() fastly, y or n
_start_fast=y
# whether to gz the target file,  none or gz
_compress_type=none
# if the non archived WAL files , more than this setting
# show ERROR and break the backup-init, fixed unit in MB, 128 ~ 1024
_non_archived_space=1024


# Cipher type used to encrypt the repository, default is none
#_repo_cipher_type="aes-256-cbc"


# Password used to encrypt/decrypt files of the repository
#_repo_cipher_pass="c3k5ODQyLg=="


# disable statistics of archived files or not, n or y
_archive_statistics=n

设置免密登录

进入 /opt/Kingbase/ES/V8/Server/bin 目录下

./sys_encpwd -H \* -P \* -D \* -U system -W 123456
-U 用户 -W 密码


./ksql -Usystem 123456

初始化脚本

进入 /opt/Kingbase/ES/V8/Server/bin 目录下

./sys_backup.sh init

根据上方参数_repo_path="/home/kingbase/kbbr_repo"会自动生成此目录

启动备份

./sys_backup.sh start

检查

查看备份信息

cd /home/kingbase/kbbr_repo   --目录根据备份计划自动生成
cat sys_rman.conf          

人大金仓开启备份策略_第3张图片

查看备份文件

cd /home/kingbase/kbbr_repo/backup/kingbase
ll
drwxr-x--- 4 kingbase kingbase   90 Nov 13 18:33 20231113-183238F
drwxr-x--- 4 kingbase kingbase   90 Nov 14 02:00 20231114-020002F
drwxr-x--- 3 kingbase kingbase   18 Nov 13 18:33 backup.history
-rw-r----- 1 kingbase kingbase 1768 Nov 14 02:00 backup.info
-rw-r----- 1 kingbase kingbase 1768 Nov 14 02:00 backup.info.copy
lrwxrwxrwx 1 kingbase kingbase   16 Nov 14 02:00 latest -> 20231114-020002F

错误

如果初始化遇到上图错误,因为没有开启 secourecmdd 工作

cd /opt/Kingbase/ES/V8/ClientTools/guitools/DeployTools/zip
cd securecmdd/bin
sh sys_HAscmdd.sh init
sh sys_HAscmdd.sh start

你可能感兴趣的:(数据库)