暂无图片
暂无图片
2
暂无图片
暂无图片
暂无图片

greenplum 备份恢复方案

前言

Greenplum数据库集群虽然支持关系型数据库事务的ACID特性,可以用在OLTP业务场景,但它的定位还是数据仓库,主要用来支撑OLAP业务场景,其数据来源更多的是从其他数据库汇聚过来,而不是直接由业务产生的,对于greenplum集群来说,PITR的场景需求并不高,且其自身提供了镜像(standby + mirror)来保证集群的高可用,所以Greenplum目前的备份恢复方案指的都是逻辑备份恢复。

Greenplum提供两种备份恢复方式:并行和非并行

  • 并行方式:master节点会备份ddl和元数据文件,各个segment会将自己的数据以CSV的方式存储在本地服务器上,如果将备份恢复到其他集群,需要保证其他集群和原集群有相同的架构

    • GP5.X gpcrondump 和 gpdbrestore 是推荐的备份恢复工具
    • GP6.X 去掉了gpcrondump 和 gpdbrestore工具的支持,gpbackup 和 gprestore 成为推荐的备份恢复工具
  • 非并行方式:所有的数据通过网络存放到master节点服务器,这需要master节点有足够的磁盘空间,这种方式不要求新集群与原集群有相同的架构,典型的工具是pg_dump/pg_dumpall、pg_restore

在之前的文章里介绍了Greenplum 安装部署greenplum 6.x 小版本升级,使用的Greenplum的版本是6.22.0,所以做6.22.0的备份恢复测试,即gpbackup和gprestore

[gpadmin@node1 ~]$ gpstate -i
20220927:22:11:15:017746 gpstate:node1:gpadmin-[INFO]:-Starting gpstate with args: -i
20220927:22:11:15:017746 gpstate:node1:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.22.0 build commit:4b6c079bc3aed35b2f161c377e208185f9310a69 Open Source'
20220927:22:11:15:017746 gpstate:node1:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.22.0 build commit:4b6c079bc3aed35b2f161c377e208185f9310a69 Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Sep  8 2022 22:41:44

gpbackup和gprestore

gpbackup和gprestore工具并没有和数据库安装包在一起,需要单独下载,参考文档安装,备份和恢复工具的版本号与数据库版本也是分离的,但会向下兼容,这里选用当前最新的版本1.25

使用限制

  • Tanzu Greenplum 4.3.22 and later
  • Tanzu Greenplum 5.5.0 and later
  • Tanzu Greenplum 6.0.0 and later
  • 不同的gpbackup会生成不同的时间戳,gprestore 必须通过–timestamp选项指定
  • 备份是指定了–single-data-file,则恢复时不能使用并行
  • 不能将扩容前的备份恢复到扩容后的集群
  • 备份的同时执行DDL操作,会到导致备份失败

增量备份条件

  • 在全量/增量备份以后有以下操作之一:ALTER TABLE、DELETE、INSERT、TRUNCATE、UPDATE、DROP and then re-create the table
  • 需要一个备份集,包括全量备份和所有基于此全量备份的所有增量备份
  • 备份集内的所有备份都需要指定–leaf-partition-data参数
  • 增量备份只对AO表有效,Heap表每次都会进行全量备份,而创建表默认是Heap表,且创建AO不能有唯一索引

安装软件

这里下载gppkg文件,然后通过greenplum自带的gppkg工具进行安装

[root@node1 software]# ll |grep -i pivotal_greenplum_backup_restore-1.25.0-gp6-rhel-x86_64.gppkg
-rw-r--r--.  1 gpadmin gpadmin  15722882 Sep 27 22:37 pivotal_greenplum_backup_restore-1.25.0-gp6-rhel-x86_64.gppkg

[gpadmin@node1 ~]$ gppkg -i /opt/software/pivotal_greenplum_backup_restore-1.25.0-gp6-rhel-x86_64.gppkg
20220927:22:40:51:020460 gppkg:node1:gpadmin-[INFO]:-Starting gppkg with args: -i /opt/software/pivotal_greenplum_backup_restore-1.25.0-gp6-rhel-x86_64.gppkg
20220927:22:40:51:020460 gppkg:node1:gpadmin-[INFO]:-Installing package pivotal_greenplum_backup_restore-1.25.0-gp6-rhel-x86_64.gppkg
20220927:22:40:51:020460 gppkg:node1:gpadmin-[INFO]:-Validating rpm installation cmdStr='rpm --test -i /opt/greenplum-db-6.22.0/.tmp/gpbackup_tools_RHEL-1.25.0-1.x86_64.rpm --dbpath /opt/greenplum-db-6.22.0/share/packages/database --prefix /opt/greenplum-db-6.22.0'
20220927:22:40:56:020460 gppkg:node1:gpadmin-[INFO]:-Installing pivotal_greenplum_backup_restore-1.25.0-gp6-rhel-x86_64.gppkg locally
20220927:22:40:57:020460 gppkg:node1:gpadmin-[INFO]:-Validating rpm installation cmdStr='rpm --test -i /opt/greenplum-db-6.22.0/.tmp/gpbackup_tools_RHEL-1.25.0-1.x86_64.rpm --dbpath /opt/greenplum-db-6.22.0/share/packages/database --prefix /opt/greenplum-db-6.22.0'
20220927:22:40:57:020460 gppkg:node1:gpadmin-[INFO]:-Installing rpms cmdStr='rpm -i --force /opt/greenplum-db-6.22.0/.tmp/gpbackup_tools_RHEL-1.25.0-1.x86_64.rpm --dbpath /opt/greenplum-db-6.22.0/share/packages/database --prefix=/opt/greenplum-db-6.22.0'
20220927:22:40:58:020460 gppkg:node1:gpadmin-[INFO]:-Completed local installation of pivotal_greenplum_backup_restore-1.25.0-gp6-rhel-x86_64.gppkg.
20220927:22:40:58:020460 gppkg:node1:gpadmin-[INFO]:-gpbackup 1.25.0 successfully installed
20220927:22:40:58:020460 gppkg:node1:gpadmin-[INFO]:-pivotal_greenplum_backup_restore-1.25.0-gp6-rhel-x86_64.gppkg successfully installed.

[gpadmin@node1 ~]$ gpbackup --version
gpbackup version 1.25.0
[gpadmin@node1 ~]$ gprestore --version
gprestore version 1.25.0

数据库准备

--普通表
gptestdb=# create table t(id serial primary key, vcharcol varchar(8), timecol timestamptz default now());

--AO表
gptestdb=# create table tao(id serial, vcharcol varchar(8), timecol timestamptz default now()) with (appendoptimized=true);

--分区表
gptestdb=# create table tp(id serial primary key, vcharcol varchar(8), timecol timestamptz default now()) PARTITION BY range (id) (PARTITION p start (0) end (1000000) every (10000));

--索引
gptestdb=# create index on t(vcharcol);
gptestdb=# create index on tp(vcharcol);

--准备数据
gptestdb=# insert into t select generate_series(1,1000);
gptestdb=# insert into tao select generate_series(1,10);
gptestdb=# insert into tp select generate_series(1,100000);

gpbackup工具

此工具用来对数据库做备份,支持全量备份和增量备份,可以备份指定数据库中的指定schema或指定表,也可以排除指定schema或指定表

[gpadmin@node1 gpdata]$ gpbackup --help
gpbackup is the parallel backup utility for Greenplum

Usage:
  gpbackup [flags]

Flags:
      --backup-dir string            The absolute path of the directory to which all backup files will be written
      --compression-level int        Level of compression to use during data backup. Range of valid values depends on compression type (default 1)
      --compression-type string      Type of compression to use during data backup. Valid values are 'gzip', 'zstd' (default "gzip")
      --copy-queue-size int          number of COPY commands gpbackup should enqueue when backing up using the --single-data-file option (default 1)
      --data-only                    Only back up data, do not back up metadata
      --dbname string                The database to be backed up
      --debug                        Print verbose and debug log messages
      --exclude-schema stringArray   Back up all metadata except objects in the specified schema(s). --exclude-schema can be specified multiple times.
      --exclude-schema-file string   A file containing a list of schemas to be excluded from the backup
      --exclude-table stringArray    Back up all metadata except the specified table(s). --exclude-table can be specified multiple times.
      --exclude-table-file string    A file containing a list of fully-qualified tables to be excluded from the backup
      --from-timestamp string        A timestamp to use to base the current incremental backup off
      --help                         Help for gpbackup
      --include-schema stringArray   Back up only the specified schema(s). --include-schema can be specified multiple times.
      --include-schema-file string   A file containing a list of schema(s) to be included in the backup
      --include-table stringArray    Back up only the specified table(s). --include-table can be specified multiple times.
      --include-table-file string    A file containing a list of fully-qualified tables to be included in the backup
      --incremental                  Only back up data for AO tables that have been modified since the last backup
      --jobs int                     The number of parallel connections to use when backing up data (default 1)
      --leaf-partition-data          For partition tables, create one data file per leaf partition instead of one data file for the whole table
      --metadata-only                Only back up metadata, do not back up data
      --no-compression               Skip compression of data files
      --plugin-config string         The configuration file to use for a plugin
      --quiet                        Suppress non-warning, non-error log messages
      --single-data-file             Back up all data to a single file instead of one per table
      --verbose                      Print verbose log messages
      --version                      Print version number and exit
      --with-stats                   Back up query plan statistics
      --without-globals              Skip backup of global metadata
全量备份
[gpadmin@node1 ~]$ gpbackup --backup-dir /data/gpdata/backup --compression-level 5 --dbname gptestdb --jobs 8
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-gpbackup version = 1.25.0
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Greenplum Database Version = 6.22.0 build commit:4b6c079bc3aed35b2f161c377e208185f9310a69 Open Source
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Starting backup of database gptestdb
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Backup Timestamp = 20220928111945
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Backup Database = gptestdb
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Gathering table state information
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Acquiring ACCESS SHARE locks on tables
Locks acquired:  2 / 2 [================================================================] 100.00% 0s
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Gathering additional table metadata
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Getting partition definitions
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Getting storage information
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Getting child partitions with altered schema
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Metadata will be written to /data/gpdata/backup/gpseg-1/backups/20220928/20220928111945/gpbackup_20220928111945_metadata.sql
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Writing global database metadata
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Global database metadata backup complete
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Writing pre-data metadata
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Pre-data metadata metadata backup complete
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Writing post-data metadata
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Post-data metadata backup complete
20220928:11:19:45 gpbackup:gpadmin:node1:023169-[INFO]:-Writing data to file
Tables backed up:  2 / 2 [==============================================================] 100.00% 0s
20220928:11:19:46 gpbackup:gpadmin:node1:023169-[INFO]:-Data backup complete
20220928:11:19:47 gpbackup:gpadmin:node1:023169-[INFO]:-Found neither /opt/greenplum-db-6.22.0/bin/gp_email_contacts.yaml nor /home/gpadmin/gp_email_contacts.yaml
20220928:11:19:47 gpbackup:gpadmin:node1:023169-[INFO]:-Email containing gpbackup report /data/gpdata/backup/gpseg-1/backups/20220928/20220928111945/gpbackup_20220928111945_report will not be sent
20220928:11:19:47 gpbackup:gpadmin:node1:023169-[INFO]:-Backup completed successfully

备份结构查看

--master节点,包括备份工具信息、备份命令和参数、备份报告 及 集群元数据和DDL

[gpadmin@node1 backup]$ cd /data/gpdata/backup/gpseg-1/backups/20220928/20220928111945/
[gpadmin@node1 20220928111945]$ ll
total 32
-r--r--r--. 1 gpadmin gpadmin   745 Sep 28 11:19 gpbackup_20220928111945_config.yaml
-r--r--r--. 1 gpadmin gpadmin 15076 Sep 28 11:19 gpbackup_20220928111945_metadata.sql
-r--r--r--. 1 gpadmin gpadmin  1858 Sep 28 11:19 gpbackup_20220928111945_report
-r--r--r--. 1 gpadmin gpadmin  4595 Sep 28 11:19 gpbackup_20220928111945_toc.yaml

--segment节点,每个表生成一个压缩文件

[gpadmin@node1 backup]$ ssh node2
Warning: the RSA host key for 'node2' differs from the key for the IP address '192.168.122.157'
Offending key for IP in /home/gpadmin/.ssh/known_hosts:1
Matching host key in /home/gpadmin/.ssh/known_hosts:5
Last login: Tue Sep 27 22:43:19 2022
[gpadmin@node2 ~]$ cd /data/gpdata/backup/
[gpadmin@node2 backup]$ ls -l
total 0
drwxrwxr-x. 3 gpadmin gpadmin 21 Sep 28 11:19 gpseg0
drwxrwxr-x. 3 gpadmin gpadmin 21 Sep 28 11:19 gpseg1
[gpadmin@node2 backup]$ cd gpseg0
[gpadmin@node2 gpseg0]$ ls -l
total 0
drwxrwxr-x. 3 gpadmin gpadmin 22 Sep 28 11:19 backups
[gpadmin@node2 gpseg0]$ cd backups/
[gpadmin@node2 backups]$ ls -l
total 0
drwxrwxr-x. 3 gpadmin gpadmin 28 Sep 28 11:19 20220928
[gpadmin@node2 backups]$ cd 20220928/
[gpadmin@node2 20220928]$ ls -l
total 0
drwxrwxr-x. 2 gpadmin gpadmin 90 Sep 28 11:19 20220928111945
[gpadmin@node2 20220928]$ cd 20220928111945/
[gpadmin@node2 20220928111945]$ ls -l
total 80
-rw-------. 1 gpadmin gpadmin   705 Sep 28 11:19 gpbackup_0_20220928111945_16848.gz
-rw-------. 1 gpadmin gpadmin 74515 Sep 28 11:19 gpbackup_0_20220928111945_16858.gz
增量备份
--全量备份,这里添加了参数--leaf-partition-data,所以在segment节点每个分区都是单独的一个数据压缩文件
[gpadmin@node1 ~]$ gpbackup --backup-dir /data/gpdata/backup --compression-level 5 --dbname gptestdb --jobs 8  --leaf-partition-data

--增量备份,如果--from-timestamp参数不置顶,它会尝试自己去找有效备份集
[gpadmin@node1 ~]$ gpbackup --backup-dir /data/gpdata/backup --compression-level 5 --dbname gptestdb --jobs 8 --incremental --leaf-partition-data --from-timestamp 20220928134435

gprestore工具

[gpadmin@node1 ~]$ gprestore --help
gprestore is the parallel restore utility for Greenplum

Usage:
  gprestore [flags]

Flags:
      --backup-dir string            The absolute path of the directory in which the backup files to be restored are located
      --copy-queue-size int          Number of COPY commands gprestore should enqueue when restoring a backup taken using the --single-data-file option (default 1)
      --create-db                    Create the database before metadata restore
      --data-only                    Only restore data, do not restore metadata
      --debug                        Print verbose and debug log messages
      --exclude-schema stringArray   Restore all metadata except objects in the specified schema(s). --exclude-schema can be specified multiple times.
      --exclude-schema-file string   A file containing a list of schemas that will not be restored
      --exclude-table stringArray    Restore all metadata except the specified relation(s). --exclude-table can be specified multiple times.
      --exclude-table-file string    A file containing a list of fully-qualified relation(s) that will not be restored
      --help                         Help for gprestore
      --include-schema stringArray   Restore only the specified schema(s). --include-schema can be specified multiple times.
      --include-schema-file string   A file containing a list of schemas that will be restored
      --include-table stringArray    Restore only the specified relation(s). --include-table can be specified multiple times.
      --include-table-file string    A file containing a list of fully-qualified relation(s) that will be restored
      --incremental                  BETA FEATURE: Only restore data for all heap tables and only AO tables that have been modified since the last backup
      --jobs int                     Number of parallel connections to use when restoring table data and post-data (default 1)
      --metadata-only                Only restore metadata, do not restore data
      --on-error-continue            Log errors and continue restore, instead of exiting on first error
      --plugin-config string         The configuration file to use for a plugin
      --quiet                        Suppress non-warning, non-error log messages
      --redirect-db string           Restore to the specified database instead of the database that was backed up
      --redirect-schema string       Restore to the specified schema instead of the schema that was backed up
      --run-analyze                  Run ANALYZE on restored tables
      --timestamp string             The timestamp to be restored, in the format YYYYMMDDHHMMSS
      --truncate-table               Removes data of the tables getting restored
      --verbose                      Print verbose log messages
      --version                      Print version number and exit
      --with-globals                 Restore global metadata
      --with-stats                   Restore query plan statistics

恢复整个数据库

--重命名数据库
postgres=# alter database gptestdb rename to gptestdb_old;
ALTER DATABASE
postgres=# \l+
                                                                  List of databases
     Name     |  Owner  | Encoding |  Collate   |   Ctype    |  Access privileges  |  Size  | Tablespace |                Description
--------------+---------+----------+------------+------------+---------------------+--------+------------+--------------------------------------------
 gptestdb_old | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 |                     | 140 MB | pg_default |
 postgres     | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 |                     | 83 MB  | pg_default | default administrative connection database
 template0    | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +| 81 MB  | pg_default | unmodifiable empty database
              |         |          |            |            | gpadmin=CTc/gpadmin |        |            |
 template1    | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +| 82 MB  | pg_default | default template for new databases
              |         |          |            |            | gpadmin=CTc/gpadmin |        |            |
(4 rows)

--恢复数据库
[gpadmin@node1 ~]$ gprestore --create-db  --backup-dir /data/gpdata/backup/ --timestamp 20220928143051 --jobs 8
20220928:14:50:57 gprestore:gpadmin:node1:010270-[INFO]:-Restore Key = 20220928143051
20220928:14:50:57 gprestore:gpadmin:node1:010270-[INFO]:-gpbackup version = 1.25.0
20220928:14:50:57 gprestore:gpadmin:node1:010270-[INFO]:-gprestore version = 1.25.0
20220928:14:50:57 gprestore:gpadmin:node1:010270-[INFO]:-Greenplum Database Version = 6.22.0 build commit:4b6c079bc3aed35b2f161c377e208185f9310a69 Open Source
20220928:14:50:57 gprestore:gpadmin:node1:010270-[INFO]:-Creating database
20220928:14:50:58 gprestore:gpadmin:node1:010270-[INFO]:-Database creation complete for: gptestdb
20220928:14:50:58 gprestore:gpadmin:node1:010270-[INFO]:-Restoring pre-data metadata
Pre-data objects restored:  19 / 19 [===================================================] 100.00% 0s
20220928:14:50:58 gprestore:gpadmin:node1:010270-[INFO]:-Pre-data metadata restore complete
Tables restored:  102 / 102 [===========================================================] 100.00% 0s
20220928:14:50:59 gprestore:gpadmin:node1:010270-[INFO]:-Data restore complete
20220928:14:50:59 gprestore:gpadmin:node1:010270-[INFO]:-Restoring post-data metadata
Post-data objects restored:  4 / 4 [====================================================] 100.00% 0s
20220928:14:50:59 gprestore:gpadmin:node1:010270-[INFO]:-Post-data metadata restore complete
20220928:14:50:59 gprestore:gpadmin:node1:010270-[INFO]:-Found neither /opt/greenplum-db-6.22.0/bin/gp_email_contacts.yaml nor /home/gpadmin/gp_email_contacts.yaml
20220928:14:50:59 gprestore:gpadmin:node1:010270-[INFO]:-Email containing gprestore report /data/gpdata/backup/gpseg-1/backups/20220928/20220928143051/gprestore_20220928143051_20220928145057_report will not be sent
20220928:14:50:59 gprestore:gpadmin:node1:010270-[INFO]:-Restore completed successfully
[gpadmin@node1 ~]$

--检查
postgres=# \c gptestdb
You are now connected to database "gptestdb" as user "gpadmin".
gptestdb=# select * from tao;
 id | vcharcol |            timecol
----+----------+-------------------------------
  2 |          | 2022-09-28 14:29:48.881934+08
  9 |          | 2022-09-28 14:29:48.881934+08
  3 |          | 2022-09-28 14:29:48.881934+08
  4 |          | 2022-09-28 14:29:48.881934+08
  7 |          | 2022-09-28 14:29:48.881934+08
  8 |          | 2022-09-28 14:29:48.881934+08
  1 |          | 2022-09-28 14:29:48.881934+08
  1 |          | 2022-09-28 14:30:45.750675+08
  5 |          | 2022-09-28 14:29:48.881934+08
  6 |          | 2022-09-28 14:29:48.881934+08
 10 |          | 2022-09-28 14:29:48.881934+08
(11 rows)

恢复一张表的数据

[gpadmin@node1 ~]$ gprestore --backup-dir /data/gpdata/backup/ --timestamp 20220928143051 --jobs 8 --include-table public.tao --data-only

gpbackup_manager

此工具用来管理备份集,包括删除备份集,查看备份集和查看备份报告等

[gpadmin@node1 ~]$ gpbackup_manager --help

gpbackup_manager helps manage Greenplum Database backup sets

Usage:
  gpbackup_manager [command]

Available Commands:
  completion       Generate the autocompletion script for the specified shell
  delete-backup    Deletes the backup set for the specified timestamp
  display-report   Display the backup report for the specified timestamp
  encrypt-password Encrypts a plain-text password to use in the DDBoost plugin configuration file
  help             Help about any command
  list-backups     Displays information in list form specific to backups which have been taken
  replicate-backup Replicates the backup set for the specified timestamp

Flags:
  -h, --help      help for gpbackup_manager
  -v, --version   version for gpbackup_manager

Use "gpbackup_manager [command] --help" for more information about a command.
查看备份
[gpadmin@node1 ~]$ gpbackup_manager list-backups

  timestamp        date                       status    database   type          object filtering   plugin   duration   date deleted
  20220928143051   Wed Sep 28 2022 14:30:51   Success   gptestdb   incremental                               00:00:03
  20220928143011   Wed Sep 28 2022 14:30:11   Success   gptestdb   incremental                               00:00:02
  20220928134744   Wed Sep 28 2022 13:47:44   Success   gptestdb   incremental                               00:00:03
  20220928134435   Wed Sep 28 2022 13:44:35   Success   gptestdb   full                                      00:00:02
  20220928133757   Wed Sep 28 2022 13:37:57   Failure   gptestdb   incremental                               00:00:02
  20220928133132   Wed Sep 28 2022 13:31:32   Failure   gptestdb   incremental                               00:00:02
  20220928133028   Wed Sep 28 2022 13:30:28   Failure   gptestdb   incremental                               00:00:01
  20220928132902   Wed Sep 28 2022 13:29:02   Failure   gptestdb   incremental                               00:00:02
  20220928132021   Wed Sep 28 2022 13:20:21   Success   gptestdb   full                                      00:00:02
  20220928131900   Wed Sep 28 2022 13:19:00   Success   gptestdb   full                                      00:00:02
  20220928111945   Wed Sep 28 2022 11:19:45   Success   gptestdb   full                                      00:00:02
删除无效备份
[gpadmin@node1 ~]$ gpbackup_manager delete-backup 20220928132902

Are you sure you want to delete-backup 20220928132902? (y/N): y
20220928:14:41:25 gpbackup_manager:gpadmin:node1:009291-[INFO]:-Deletion of 20220928132902 in progress.

Deletion of 20220928132902 done.

[gpadmin@node1 ~]$ gpbackup_manager list-backups

  timestamp        date                       status    database   type          object filtering   plugin   duration   date deleted
  20220928143051   Wed Sep 28 2022 14:30:51   Success   gptestdb   incremental                               00:00:03
  20220928143011   Wed Sep 28 2022 14:30:11   Success   gptestdb   incremental                               00:00:02
  20220928134744   Wed Sep 28 2022 13:47:44   Success   gptestdb   incremental                               00:00:03
  20220928134435   Wed Sep 28 2022 13:44:35   Success   gptestdb   full                                      00:00:02
  20220928133757   Wed Sep 28 2022 13:37:57   Failure   gptestdb   incremental                               00:00:02
  20220928133132   Wed Sep 28 2022 13:31:32   Failure   gptestdb   incremental                               00:00:02
  20220928133028   Wed Sep 28 2022 13:30:28   Failure   gptestdb   incremental                               00:00:01   Wed Sep 28 2022 14:41:41
  20220928132902   Wed Sep 28 2022 13:29:02   Failure   gptestdb   incremental                               00:00:02   Wed Sep 28 2022 14:41:25
  20220928132021   Wed Sep 28 2022 13:20:21   Success   gptestdb   full                                      00:00:02
  20220928131900   Wed Sep 28 2022 13:19:00   Success   gptestdb   full                                      00:00:02
  20220928111945   Wed Sep 28 2022 11:19:45   Success   gptestdb   full                                      00:00:02

总结

  • gpbackup 可以支持全量备份和增量备份,但增量备份只对AO表有效,对heap依然是全量备份
  • gprestore 可以恢复指定的数据库,指定schema或者table
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论