From c809dd87a494e0f8fefd844c9c8626de4247b794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B3=BD=E6=B5=A9?= <266632325+Loyal-Young@users.noreply.github.com> Date: Tue, 24 Nov 2026 01:02:58 +0800 Subject: [PATCH] docs: explain how to reconstruct an incremental backup chain Fixes #488. Assisted-by: Codex:GPT-6 Percentage of AI-generated code: 100% --- CN/modules/ROOT/pages/9.adoc | 21 +++++++++++++++++++++ EN/modules/ROOT/pages/9.adoc | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/CN/modules/ROOT/pages/9.adoc b/CN/modules/ROOT/pages/9.adoc index 2432ee47..622d3cce 100644 --- a/CN/modules/ROOT/pages/9.adoc +++ b/CN/modules/ROOT/pages/9.adoc @@ -1077,6 +1077,27 @@ $ pg_basebackup -D - -Ft -X fetch | bzip2 > backup.tar.bz2 $ pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts ``` +==== 合成增量备份链 + +要恢复 `inc2`,按时间顺序传入完整备份和它依赖的每份增量备份。对于 `full` → `inc1` → `inc2` 这条备份链,使用为空或尚未创建的输出目录 `/srv/backup/rebuilt`。命令结束前,保留所有输入备份及其清单。 + +[source,sh] +---- +pg_combinebackup --output=/srv/backup/rebuilt /srv/backup/full /srv/backup/inc1 /srv/backup/inc2 +pg_verifybackup /srv/backup/rebuilt +---- + +`pg_combinebackup` 在输出目录中生成完整备份。启动恢复实例前,用 `pg_verifybackup` 对照清单检查合成结果。 + +如果集簇还有额外表空间,将最后一份输入备份中的表空间路径映射到空的恢复位置。如果 `pg_basebackup` 已重定位表空间,应使用备份路径。例如,`inc2` 将一个表空间链接到 `/srv/backup/inc2-ts` 时,第一条命令使用以下形式。 + +[source,sh] +---- +pg_combinebackup --output=/srv/backup/rebuilt --tablespace-mapping=/srv/backup/inc2-ts=/restore/ts /srv/backup/full /srv/backup/inc1 /srv/backup/inc2 +---- + +映射的目标目录也应为空或尚未创建,用于保存合成后的表空间文件。 + === pgbench pgbench — 在IvorySQL上运行一个基准测试 diff --git a/EN/modules/ROOT/pages/9.adoc b/EN/modules/ROOT/pages/9.adoc index d4b420c6..34f7b9bc 100644 --- a/EN/modules/ROOT/pages/9.adoc +++ b/EN/modules/ROOT/pages/9.adoc @@ -1087,6 +1087,27 @@ To create a backup of a local server with one tar file for each tablespace compr $ pg_basebackup -D backup -Ft --compress=gzip:9 ``` +==== Reconstruct an incremental backup + +To restore `inc2`, supply the full backup and every incremental backup on which it depends, in chronological order. For a chain `full` → `inc1` → `inc2`, use empty or nonexistent output directory `/srv/backup/rebuilt`. Keep the input backups and their manifests available until the command finishes. + +[source,sh] +---- +pg_combinebackup --output=/srv/backup/rebuilt /srv/backup/full /srv/backup/inc1 /srv/backup/inc2 +pg_verifybackup /srv/backup/rebuilt +---- + +`pg_combinebackup` writes a full backup to the output directory. Use `pg_verifybackup` to check that reconstructed backup against its manifest before starting a server from it. + +For additional tablespaces, map their paths in the last input backup to empty restore locations. If `pg_basebackup` relocated the tablespaces, use those backup paths, not the paths on the source server. For example, when `inc2` links a tablespace to `/srv/backup/inc2-ts`, use this form of the first command. + +[source,sh] +---- +pg_combinebackup --output=/srv/backup/rebuilt --tablespace-mapping=/srv/backup/inc2-ts=/restore/ts /srv/backup/full /srv/backup/inc1 /srv/backup/inc2 +---- + +The mapping's destination must also be empty or nonexistent. It identifies where the reconstructed tablespace files will be written. + === pgbench pgbench — run a benchmark test on IvorySQL