GBase 8c 备份恢复实践教程:远程恢复物理备份数据

1. 搭建远程数据库并备份数据库目录

集中式场景下,搭建远程数据库完成后,停止数据库运行,并备份远程数据库的dn数据目录,新建一个空的dn目录。

gs_om -t stop

以远程数据库目录为/data/software/Gbase/install/data/dn为例

mv /data/software/Gbase/install/data/dn /data/software/Gbase/install/data/dn_bak
mkdir /data/software/Gbase/install/data/dn

2.配置当前数据库备份文件所在的节点和远程数据库节点的互信

新建文件hostfile,写入需要配置互信的节点IP(每行只写一个IP)

cd 安装包目录/script/
./gs_sshexkey -f /opt/software/hostfile

3.在当前数据库检查备份文件是否符合恢复要求

检查项包括:

1)所有备份状态(status)列均为OK;

2)备份的recovery time列和备份时间相符合,不出现2000-00-00的时间点。

a.若备份状态的status列不为OK,则该次备份不能进行数据恢复操作,需要重新备份,或者使用更早的备份进行恢复;

b.若备份的recovery time列和备份时间相符合。

gs_probackup show -B /gbase/database/backup/bakfile/physic/

4.执行物理备份恢复命令

在有备份文件的数据库节点(备份目录/gbase/database/backup/bakfile/physic/),执行远程恢复命令(SXR8O2为备份文件的ID):

gs_probackup restore –B /gbase/database/backup/bakfile/physic/ --instance gbase –D /data/software/Gbase/install/data/dn –I SXR8O2 –remote-host=远程数据库节点IP –remote-port=22 –remote-user=gbase –remote-proto=ssh

执行完成后会在远程数据库的/data/software/Gbase/install/data/下新生成一个dn目录(/data/software/Gbase/install/data/dn)

使用远程集群的dn1目录中的postgresql.conf和pg_hba.conf 覆盖备份恢复完成的dn目录下的对应文件,然后启动数据库。

cp /data/software/Gbase/install/data/dn_bak/postgresql.conf /data/software/Gbase/install/data/dn/postgresql.conf
cp /data/software/Gbase/install/data/dn_bak/pg_hba.conf
/data/software/Gbase/install/data/dn/ pg_hba.conf
gs_om -t start

5.查看集群状态以及数据

gs_om -t status --detail

原创文章,作者:kirin,如若转载,请注明出处:https://blog.ytso.com/tech/bigdata/317648.html

(0)
上一篇 44分钟前
下一篇 38分钟前

相关推荐

发表回复

登录后才能评论