关键字:
KingbaseES、物理备份、sys_rman_v6、人大金仓、KingbaseES
sys_rman_v6概述
sys_rman_v6支持全量、增量、差异备份。
(1)术语相关
sys_rman_v6:可执行文件,执行各种操作,位于bin目录下。
sys_backup.sh:脚本文件,协助管理员完成配置与调度工作,位于bin目录下。
sys_backup.conf:配置调度脚本对应的配置文件,可配置各种参数,位于share目录下。
stanza:表示一个集群。
repo:仓库,实际存储备份文件的介质。
(2)编译安装
针对编译安装好的KES,编译安装sys_rman工具。
仓库:KES_SysRman
KES化:python pg2kingbase.py --ignore-missing-files --enable-nls -V $kingbaseversion
./make_pgbackrest.sh /home/XXX/XXX/KES_Server/release/bin/sys_config kingbaseversion(例如V008R006C007B0012)
安装完成后会在/bin目录下生成sys_rman可执行文件。
sys_rman_v6的使用
(1)配置
初始配置、备份时,必须在repo节点执行,还原必须在数据库节点上执行。
sys_rman是物理备份的热备份方式,需对data下的postgresql.conf配置文件做如下操作,wal_level = replica,archive_mode = on #打开归档archive_command = '' #自动配置。
(2)选项
./sys_rman_v6
archive-get Get a WAL segment from the archive.
archive-push Push a WAL segment to the archive.
backup Backup a database cluster.
check Check the configuration.
expire Expire backups that exceed retention.
help Get help.
info Retrieve information about backups.
repo-get Get a file from a repository.
repo-ls List files in a repository.
restore Restore a database cluster.
stanza-create Create the required stanza data.
stanza-delete Delete a stanza.
stanza-upgrade Upgrade a stanza.
start Allow sys_rman_v6 processes to run.
stop Stop sys_rman_v6 processes from running.
version Get version.
(3)初始化
配置完后,执行./sys_backup.sh init。
(4)备份
全备份
./sys_rman_v6
--config=/home/chenyouming/backups/sys_rman_v6.conf(与备份路径中conf有关)
--stanza=kingbase
--archive-copy
--type=full backup
差异备份
./sys_rman_v6
--config=/home/chenyouming/backups/sys_rman_v6.conf
--stanza=kingbase
--archive-copy
--type=diff backup
增量备份
./sys_rman_v6
--config=/home/chenyouming/backups/sys_rman_v6.conf
--stanza=kingbase
--archive-copy
(5)还原
默认还原—最新
./sys_rman_v6
--config=/home/chenyouming/backups/sys_rman_v6.conf
--stanza=kingbase
restore
问:还原到哪个目录?data?
指定备份集
./sys_rman_v6
--config=/home/chenyouming/backups/sys_rman_v6.conf
--stanza=kingbase
--set='20200519-031336f' --type=time --target='2020-05-07 16:28:17'
Restore
指定事务ID
./sys_rman_v6
--config=/home/chenyouming/backups/sys_rman_v6.conf
--stanza=kingbase
--type=xid --target='445566' --set='20210611-011416F_20210611-023050I'
restore
指定时间点
./sys_rman_v6
--config=/home/chenyouming/backups/sys_rman_v6.conf
--stanza=kingbase
--type=time --target='2020-05-07 16:28:17'
restore
(6)其他
查看备份集
./sys_rman_v6
--config=/home/chenyouming/backups/sys_rman_v6.conf
--stanza=kingbase
info
清除备份
./sys_rman_v6
--config=/home/chenyouming/backups/sys_rman_v6.conf
--stanza=kingbase
expire