当前位置: 首页 > news >正文

openGauss增量备份与恢复技术详解及定时触发实现

openGauss作为一款高性能、高可靠的开源数据库系统,支持全量备份和增量备份,以满足不同场景下的数据保护需求。本文将详细介绍openGauss的增量备份与恢复的实现方法,并提供详细的实现代码、配置说明以及如何实现定时触发增量备份操作。

0、前言

查看磁盘信息

通过df -lh命令查看

我这里将备份数据到<font style="color:rgb(18, 18, 18);">/media/user/D</font>盘符下。

查看系统信息

通过<font style="color:rgb(18, 18, 18);">cat /etc/os-release</font>命令查看

查看CPU架构信息

通过<font style="color:rgb(18, 18, 18);">lscpu</font>命令查看

一、openGauss增量备份概述

openGauss的增量备份通过gs_probackup工具实现。gs_probackup是openGauss提供的一个独立的二进制程序,支持全量备份、增量备份、对备份元数据进行管理、设置备份的留存策略、合并增量备份、删除过期备份等功能。

二、增量备份配置与实现

1. 配置参数

在openGauss中,要启用增量备份,需要在postgresql.conf配置文件中添加参数enable_cbm_tracking = on。这个参数用于启动数据库服务器对脏页数据修改的跟踪。

执行<font style="color:rgb(18, 18, 18);">gsql -d postgres -p 5432 -r</font>命令登录数据库,修改配置文件。

# 修改postgresql.conf
alter system set enable_cbm_tracking = on;
select pg_reload_conf();

执行完上面SQL代码后再次查看postgresql.conf配置文件,发现已经添加enable_cbm_tracking = on配置。

2. 初始化备份目录和实例

使用gs_probackup工具初始化备份目录和实例:

# 初始化备份目录
gs_probackup init -B /media/user/D/gs_backup/increment# 添加备份实例
gs_probackup add-instance -B /media/user/D/gs_backup/increment -D /media/user/D/datanode/gsdn --instance=rscnode

3. 备份命令与参数解释

创建全量备份

# 创建全量备份
gs_probackup backup -B /media/user/D/gs_backup/increment --instance=rscnode -b full -d electric

参数说明:

  • -B /media/user/D/gs_backup/increment:指定备份路径。
  • --instance=rscnode:指定备份实例。
  • -b full:指定备份模式为全量备份。
  • -d electric:指定要备份的数据库名

上面的命令执行后会输出如下信息:

omm@user-pc:/media/user/D/datanode/gsdn$ gs_probackup backup -B /media/user/D/gs_backup/increment --instance=rscnode -b full -d electric
INFO: Backup start, gs_probackup version: 2.4.2, instance: rscnode, backup ID: SJMVRR, backup mode: FULL, wal mode: STREAM, remote: false, compress-algorithm: none, compress-level: 1
LOG: Backup destination is initialized
LOG: This openGauss instance was initialized with data block checksums. Data block corruption will be detected
LOG: Database backup start
LOG: started streaming WAL at 6/9F000000 (timeline 1)
[2024-09-11 13:40:44]: check identify system success                                                
[2024-09-11 13:40:44]: send START_REPLICATION 6/9F000000 success                                    
[2024-09-11 13:40:44]: keepalive message is received                                                
[2024-09-11 13:40:44]: keepalive message is received                                                
INFO: PGDATA size: 13GB
INFO: Start backing up files
LOG: Creating page header map "/media/user/D/gs_backup/increment/backups/rscnode/SJMVRR/page_header_map"
[2024-09-11 13:40:49]: keepalive message is received                                                
[2024-09-11 13:40:54]: keepalive message is received         ] 42% (2653/6221, done_files/t                                                                                                    
[2024-09-11 13:40:59]: keepalive message is received                                                
[2024-09-11 13:41:04]: keepalive message is received         ]                                                                                                    
[2024-09-11 13:41:09]: keepalive message is received                                                
[2024-09-11 13:41:14]: keepalive message is received                                                                                 
[2024-09-11 13:41:19]: keepalive message is received                                                    backup file 
[2024-09-11 13:41:24]: keepalive message is received                                                
[2024-09-11 13:41:29]: keepalive message is received====     ] 90% (5626/6221, done_files/to                                                                                                    
[2024-09-11 13:41:34]: keepalive message is received                                                
[2024-09-11 13:41:39]: keepalive message is received=====    ]                                                                                                     
[2024-09-11 13:41:45]: keepalive message is received                                                                                  
[2024-09-11 13:41:50]: keepalive message is received                                                
[2024-09-11 13:41:55]: keepalive message is received                                                     ackup file 
[2024-09-11 13:42:00]: keepalive message is received                                                
[2024-0

http://www.mrgr.cn/news/24605.html

相关文章:

  • DroidBot-GPT: GPT-powered UI Automation for Android论文学习
  • Vue组件:依赖注入provide和inject的使用
  • 代码随想录算法训练营day35
  • 架构理论碰撞:对比TOGAF、Zachman、DODAF和FEAF等主流架构框架
  • 龙蟠虎踞的搜索赛道,扛得住这场风云突变吗?
  • 【C++ Primer Plus习题】15.1
  • NoSQL之Redis
  • 文章在线改写如何效率高?智能改写神有妙招!
  • 【线程池】Java 线程池 ThreadPoolExecutor 类源码介绍
  • 深入理解 JavaScript:进阶概念与实战技巧
  • Linux用户和组群账户管理
  • 使用libmpeg解码mp3格式文件
  • ORCAD位号,BOOM表
  • 【Linux】【Vim】Vim 基础
  • 【网络安全】-文件下载漏洞-pikachu
  • 什么是谷歌留痕?
  • windows下 MySQL8.4.2 LTS 解压版的安装使用
  • Python 资源管理的得力助手
  • 动态规划(算法)---03.斐波那契数列模型_最小花费爬楼梯
  • 记录一次NGINX和Java后端造成的CORS跨域BUG