openGauss 数据库物理结构与控制文件说明
在 openGauss 数据库集群初始化时会创建数据目录,一般通过环境变量$PGDATA指向该目录。数据库初始化完成后,会在此目录下生成各类子目录与数据文件。
openGauss 存在对应的物理结构示意图(原文附图)。
控制文件介绍
openGauss 的控制文件保存数据库运行核心元信息,包含:数据库 OID、数据库实例状态、WAL 日志位置、检查点相关信息等,是数据库非常关键的文件。
- 默认路径:
$PGDATA/global/pg_control - 查看工具:
bin/pg_controldata,可读取解析控制文件内容。
原文附带视频讲解。
| 视频讲解如下 |
|---|
【赵渝强老师】高斯数据库(openGauss)的控制文件 |
查看控制文件操作步骤
1. 进入 openGauss 安装目录
cd/home/postgres/training/gaussdb2. 执行 pg_controldata 查看控制文件内容
[postgres@opengauss gaussdb]$ pg_controldata data/single_node命令输出示例
pg_control version number: 923 Catalog version number: 201611171 Database system identifier: 3423487896412314 Database cluster state: in production pg_control last modified: 2026年10月07日 星期一 01时33分26秒 Latest checkpoint location: 0/4002600 Prior checkpoint location: 0/40024E0 Latest checkpoint's REDO location: 0/4002580 Latest checkpoint's TimeLineID: 1 Latest checkpoint's full_page_writes: off Latest checkpoint's NextXID: 15853 Latest checkpoint's NextOID: 16525 Latest checkpoint's NextMultiXactId: 2 Latest checkpoint's NextMultiOffset: 0 Latest checkpoint's oldestXID: 11555 Latest checkpoint's oldestXID's DB: 14809 Latest checkpoint's oldestActiveXID: 15853 Latest checkpoint's remove lsn: 0/1 Time of latest checkpoint: 2026年10月07日 星期一 01时33分26秒 Minimum recovery ending location: 0/0 Backup start location: 0/0 Backup end location: 0/0 End-of-backup record required: no Current wal_level setting: hot_standby Current max_connections setting: 250 Current max_prepared_xacts setting: 200 Current max_locks_per_xact setting: 256 Maximum data alignment: 8 Database block size: 8192 Blocks per segment of large relation: 131072 WAL block size: 8192 Bytes per WAL segment: 16777216 Maximum length of identifiers: 64 Maximum columns in an index: 32 Maximum size of a TOAST chunk: 1996 Date/time type storage: 64‑bit integers Float4 argument passing: by value Float8 argument passing: by value Database system TimeLine: 9