pg_probackup 之一 简介

os: centos 7.4
db: postgresql 9.6
pg_probackup: 2.1.5

pg_probackup 是 postgres pro 一款优秀的备份还原工具,目前兼容 PostgreSQL 9.5, 9.6, 10, 11;

pg_probackup 的官宣优点

As compared to other backup solutions, pg_probackup offers the following benefits that can help you implement different backup strategies and deal with large amounts of data:

  • Choosing between full and page-level incremental backups to speed up backup and recovery
  • Implementing a single backup strategy for multi-server PostgreSQL clusters
  • Automatic data consistency checks and on-demand backup validation without actual data recovery
  • Managing backups in accordance with retention policy
  • Merging incremental into full backups without actual data recovery
  • Running backup, restore, merge and validation processes on multiple parallel threads
  • Storing backup data in a compressed state to save disk space
  • Taking backups from a standby server to avoid extra load on the master server
  • Extended logging settings
  • Custom commands to simplify WAL log archiving
  • External to PGDATA directories, such as directories with config files and scripts, can be included in backup
  • Remote backup, restore, add-instance, archive-push and archive-get operations via ssh (beta)
  • Checking running PostgreSQL instance for the sights of corruption in read-only mode via checkdb command.

以上是 pg_probackup 宣传的一些优点,还挺能吹,哈哈。

pg_probackup 的备份方式

To manage backup data, pg_probackup creates a backup catalog. This directory stores all backup files with additional meta information, as well as WAL archives required for point-in-time recovery. You can store backups for different instances in separate subdirectories of a single backup catalog.

Using pg_probackup, you can take full or incremental backups:

  • Full backups contain all the data files required to restore the database cluster from scratch.

  • Incremental backups only store the data that has changed since the previous backup. It allows to decrease the backup size and speed up backup operations. pg_probackup supports the following modes of incremental backups:

    • PAGE backup.
      In this mode, pg_probackup scans all WAL files in the archive from the moment the previous full or incremental backup was taken. Newly created backups contain only the pages that were mentioned in WAL records. This requires all the WAL files since the previous backup to be present in the WAL archive. If the size of these files is comparable to the total size of the database cluster files, speedup is smaller, but the backup still takes less space.
    • DELTA backup.
      In this mode, pg_probackup read all data files in PGDATA directory and only those pages, that where changed since previous backup, are copied. Continuous archiving is not necessary for it to operate. Also this mode could impose read-only I/O pressure equal to Full backup.
    • PTRACK backup.
      In this mode, PostgreSQL tracks page changes on the fly. Continuous archiving is not necessary for it to operate. Each time a relation page is updated, this page is marked in a special PTRACK bitmap for this relation. As one page requires just one bit in the PTRACK fork, such bitmaps are quite small. Tracking implies some minor overhead on the database server operation, but speeds up incremental backups significantly.

Regardless of the chosen backup type, all backups taken with pg_probackup support the following strategies of WAL delivery:

Autonomous backups streams via replication protocol all the WAL files required to restore the cluster to a consistent state at the time the backup was taken. Even if continuous archiving is not set up, the required WAL segments are included into the backup.
Archive backups rely on continuous archiving.

另外 PTRACK backup 有额外的要求

ptrack support
PTRACK backup support provided via following options:

vanilla PostgreSQL compiled with ptrack patch. Currently there are patches for PostgreSQL 9.6 and PostgreSQL 10
Postgres Pro Standard 9.5, 9.6, 10, 11
Postgres Pro Enterprise 9.5, 9.6, 10

接下来会对 pg_probackup 做进一步的测试。

参考:
https://github.com/postgrespro/pg_probackup
https://postgrespro.com/products/extensions/pg_probackup

https://github.com/postgrespro/pg_probackup/blob/master/Documentation.md
https://postgrespro.github.io/pg_probackup/
https://postgrespro.com/docs/postgrespro/9.6/app-pgprobackup

你可能感兴趣的:(#,postgresql,backup,recovery)