一、opengauss 的背景和行业现状
2022 年,七大 openGauss 商业版发布,是基于 openGauss3.0 推出商业发行版
目前海量数据库 Vastbase 表现最佳,一直是 TOP 1
作者认为之所以海量数据库 Vastbase 目前无法被同行超越,和各家研发实力和技术背景有关
众所周知,opengauss 起源于 postgresql,在此基础上做了改良
海量数据库从 postgresql 就已经开始做商业版,一直做到 opengauss,经验最丰富,其他产品例如 MongoDB 是紧随其后 (在此不讨论其存在的意义),目前产品百花齐放,更显锦上添花
Vastbase G100 采用业界证明稳定高效的日志流复制技术实现集群内主备库的数据和状态传输,
并通过一主多备的部署和配置架构实现了多点可读、数据不丢失、异地灾备等关键高可用场景。
二、初始化实验环境
2.1创建几个数据库和用户
openGauss=# create database momo24sw;
openGauss=# create database remo18sw;
openGauss=# create database momo488;
openGauss=# create user momo4le with password 'MoMo@488';
CREATE ROLE
openGauss=# grant all privileges to momo4le;
ALTER ROLE
2.2创建2个表
[omm@momo488 ~]$ gsql -d momo24sw -p 15400 -U momo4le;
Password for user momo4le:
gsql ((openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:19 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
momo24sw=> create table t1 (x int,y int);
CREATE TABLE
momo24sw=> insert into t1 values (1,1);
INSERT 0 1
momo24sw=> select * from t1;
x | y
---+---
1 | 1
(1 row)
momo24sw=> create table t2 (x int,y int);
CREATE TABLE
[omm@momo488 ~]$ gsql -d remo18sw -p 15400 -U momo4le;
Password for user momo4le:
gsql ((openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:19 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
remo18sw=> create table t2 (x int,y int);
CREATE TABLE
remo18sw=> insert into t2 values (2,2);
INSERT 0 1
remo18sw=> select * from t2;
x | y
---+---
2 | 2
(1 row)
三、适用场景
3.1逻辑备份与恢复适合于数据量小的场景。
3.2可以备份单表和多表,单database和所有database。
3.3备份后的数据需要使用gsql或者gs_restore工具恢复。
3.4数据量大时,恢复需要较长时间。
四、逻辑备份工具
4.1gs_dump
纯文本格式数据恢复时间长。
归档格式数据恢复时间中等。
gs_dump可以创建四种不同的导出文件格式,通过**[-F或者–format=]**选项指定。
4.2gs_dumpall
数据恢复时间长。
使用gs_dumpall一次导出openGauss的所有数据库
五、gs_dump实践
5.1示例1:执行gs_dump,导出mom