暂无图片
暂无图片
6
暂无图片
暂无图片
1
暂无图片

PostgreSQL 13 – 改进的基础备份

1522

译者简介

海能达数据库团队(李洋),任职于海能达通信股份有限公司哈尔滨平台中心,数据库开发高级工程师,致力于postgresql数据库在专网通信领域、公共安全领域的应用与推广,个人兴趣主要集中在:分布式数据库系统设计、高并发高可用数据库架构设计与开源数据库的源码研究。

校对者简介

崔鹏,PostgreSQL爱好者。海能达PostgreSQL高级DBA。

在本文中,我们将尝试了解 PostgreSQL 13 中 pg_basebackup 的新功能
pg_basebackup 是一个广泛使用的 PostgreSQL 备份工具,它允许我们进行在线文件系统级备份。这些备份可用于时间点恢复或设置主/备使用。
你如何进行基础备份?
可以使用以下命令进行基本备份
pg_basebackup -D u01/basebackup -Ft -z –checkpoint=fast -P
上面的命令将备份到/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
      复制
      但是那个backup_manifest文件是什么?
      好的,我可以查看备份的备份进度吗?
        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
          ...
          复制





          PostgreSQL中文社区欢迎广大技术人员投稿
          投稿邮箱:press@postgres.cn


          最后修改时间:2021-10-14 11:33:35
          文章转载自PostgreSQL中文社区,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

          评论

          筱悦星辰
          暂无图片
          9月前
          评论
          暂无图片 0
          生活就是不断突破自我的过程。我们努力地向上,不仅是让世界看到我们,更是为了让自己看到世界。
          9月前
          暂无图片 点赞
          评论