pg_basebackup不复制任何数据 /检查点是空的

发布于 2025-02-13 19:15:57 字数 2056 浏览 0 评论 0 原文

我有一个要复制的100GB数据库。

在我正在运行的目标服务器上:

sudo -iu postgres PGPASSWORD=xxx pg_basebackup -v -D /var/lib/postgresql/14/main -U postgres -X fetch -P -h source.host.com -p 5432
pg_basebackup: initiating base backup, waiting for checkpoint to complete
pg_basebackup: checkpoint completed
pg_basebackup: write-ahead log start point: 3/5000028 on timeline 1
70435/70435 kB (100%), 1/1 tablespace                                         
pg_basebackup: write-ahead log end point: 3/5000100
pg_basebackup: syncing data to disk ...
pg_basebackup: renaming backup_manifest.tmp to backup_manifest
pg_basebackup: base backup completed

退出代码为0。但是没有复制数据。目标/var/lib/lib/postgresql/14/main/base 几乎是空的,源上的100GB:

target:/var/lib/postgresql/14/main# du -d1 -h
16M ./pg_wal
540K    ./global
0   ./pg_commit_ts
0   ./pg_dynshmem
0   ./pg_notify
0   ./pg_serial
0   ./pg_snapshots
0   ./pg_subtrans
0   ./pg_twophase
16K ./pg_multixact
52M ./base
0   ./pg_replslot
0   ./pg_tblspc
0   ./pg_stat
0   ./pg_stat_tmp
8.0K    ./pg_xact
4.0K    ./pg_logical
69M .

source:/var/lib/postgresql/14/main# du -d1 -h
785M    ./pg_wal
564K    ./global
0   ./pg_commit_ts
0   ./pg_dynshmem
0   ./pg_notify
0   ./pg_serial
0   ./pg_snapshots
96K ./pg_subtrans
0   ./pg_twophase
16K ./pg_multixact
92G ./base
0   ./pg_replslot
0   ./pg_tblspc
0   ./pg_stat
72K ./pg_stat_tmp
8.0K    ./pg_xact
4.0K    ./pg_logical
92G .

目标缺少一堆1GB文件,名为/var/var/lib/lib/postgresql/14 /Main/base/19399/13633xx.yy 。但是,所有基础的分子都是相同的。

来源上的日志说:

source postgres[1658348]: [10-1]   LOG:  checkpoint starting: force wait
source postgres[1658348]: [11-1]   LOG:  checkpoint complete: wrote 0 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.007 s, sync=0.001 s, total=0.022 s; sync files=0, longest=0.000 s, average=0.000 s; distance=16383 kB, estimate=16384 kB

运行 pg_basebackup 在源中本地运行良好。

这两个服务器运行Postgres 14。

可能发生了什么?

I have a 100GB database that I want to replicate.

On the target server I'm running:

sudo -iu postgres PGPASSWORD=xxx pg_basebackup -v -D /var/lib/postgresql/14/main -U postgres -X fetch -P -h source.host.com -p 5432
pg_basebackup: initiating base backup, waiting for checkpoint to complete
pg_basebackup: checkpoint completed
pg_basebackup: write-ahead log start point: 3/5000028 on timeline 1
70435/70435 kB (100%), 1/1 tablespace                                         
pg_basebackup: write-ahead log end point: 3/5000100
pg_basebackup: syncing data to disk ...
pg_basebackup: renaming backup_manifest.tmp to backup_manifest
pg_basebackup: base backup completed

Exit code is 0. But no data is copied. Targets /var/lib/postgresql/14/main/base is virtually empty, and 100GB on the source:

target:/var/lib/postgresql/14/main# du -d1 -h
16M ./pg_wal
540K    ./global
0   ./pg_commit_ts
0   ./pg_dynshmem
0   ./pg_notify
0   ./pg_serial
0   ./pg_snapshots
0   ./pg_subtrans
0   ./pg_twophase
16K ./pg_multixact
52M ./base
0   ./pg_replslot
0   ./pg_tblspc
0   ./pg_stat
0   ./pg_stat_tmp
8.0K    ./pg_xact
4.0K    ./pg_logical
69M .

source:/var/lib/postgresql/14/main# du -d1 -h
785M    ./pg_wal
564K    ./global
0   ./pg_commit_ts
0   ./pg_dynshmem
0   ./pg_notify
0   ./pg_serial
0   ./pg_snapshots
96K ./pg_subtrans
0   ./pg_twophase
16K ./pg_multixact
92G ./base
0   ./pg_replslot
0   ./pg_tblspc
0   ./pg_stat
72K ./pg_stat_tmp
8.0K    ./pg_xact
4.0K    ./pg_logical
92G .

Target is missing a bunch of 1GB files named /var/lib/postgresql/14/main/base/19399/13633xx.yy. All subdirs of base are the same though.

Logs on the source say:

source postgres[1658348]: [10-1]   LOG:  checkpoint starting: force wait
source postgres[1658348]: [11-1]   LOG:  checkpoint complete: wrote 0 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.007 s, sync=0.001 s, total=0.022 s; sync files=0, longest=0.000 s, average=0.000 s; distance=16383 kB, estimate=16384 kB

Running pg_basebackup locally in the source works fine.

Both servers running postgres 14.

What could be going on?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞清仓 2025-02-20 19:15:57

原因是,大多数表都是表。这些未包含在检查点中。

Reason is that most tables are UNLOGGED tables. Those are not included in checkpoints.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文