PostgreSQL 13–改进后的基础备份

 

“与以前的版本相比,PostgreSQL 13 发布了160 多个新功能”

在本文中,我们将尝试了解postgresql13 pg_basebackup 的新特性

pg_basebackup 是一个广泛使用的PostgreSQL 备份工具,它允许我们进行在线和一致的文件系统级备份。这些备份可用于时间点恢复或设置从属/ 备用。

PostgreSQL 13 pg_basebackup 有什么新功能?

你怎么做基础备份?

可以使用下面的命令执行基础备份

备份- 备份- 基础- 快速检查点

上面的命令将备份到/u01/basebackup 文件夹

[postgres@postgres03   pg_wal]$ pg_basebackup -D /u01/basebackup -Ft -z --checkpoint=fast -P

2879569/2879569   kB (100%), 1/1 tablespace

[postgres@postgres03   pg_wal]$

 

现在让我检查一下文件夹的内容

[postgres@postgres03   basebackup]$ ls -lrt

total 609508

-rw-------   1 postgres postgres 581022586 Sep 24 19:28 base.tar.gz

-rw-------   1 postgres postgres 185894 Sep 24 19:28 backup_manifest

-rw-------   1 postgres postgres 42913087 Sep 24 19:28 pg_wal.tar.gz

 

但是备份清单文件是什么?

好的,我可以检查一下备份的进度吗?

postgres=# select pid, phase,   backup_total, backup_streamed from pg_stat_progress_basebackup;

  pid    |          phase           | backup_total | backup_streamed

-------+--------------------------+--------------+-----------------

 13504 | streaming database files |   2799572480 |       540401152

(1   row)

 

我能用ps-ef | grep postgres 做吗?

[postgres@postgres03   pg_wal]$ ps -ef | grep postgres

....

postgres  4466  4044   62 19:23 pts/1    00:01:00 pg_basebackup -D /u01/basebackup   -Ft -z --checkpoint=fast -P

postgres  4467  4458  4   19:23 ?        00:00:03 postgres: walsender   postgres [local] sending backup "pg_basebackup base backup"

postgres  4468  4458  0   19:23 ?        00:00:00 postgres: walsender   postgres [local] streaming 0/AAF36C08

postgres  4469  4466  8   19:23 pts/1    00:00:08 pg_basebackup -D /u01/basebackup -Ft   -z --checkpoint=fast -P

...

 

那么,两个wal senders 在这里做什么?

好吧,这篇文章很快就会更新,详细了解版本13 中的pg_basebackup

postgres=#   show server_version_num;

server_version_num

--------------------

130000

(1 row)

 

postgres=#

 

敬请期待!!


原文链接: https://postgreshelp.com/pg-basebackup-v13/


请使用浏览器的分享功能分享到微信等