Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Backup and recovery manager for PostgreSQL

License

NotificationsYou must be signed in to change notification settings

postgrespro/pg_probackup

 
 

Repository files navigation

pg_probackup is a utility to manage backup and recovery of PostgreSQL database clusters. It is designed to perform periodic backups of the PostgreSQL instance that enable you to restore the server in case of a failure.

The utility is compatible with:

  • PostgreSQL 9.5, 9.6, 10, 11;

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, archive-push and archive-get operations via ssh (beta)
  • Checking running PostgreSQL instance for the sights of corruption in read-only mode viacheckdb command.

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 forpoint-in-time recovery. You can store backups for different instances in separate subdirectories of a single backup catalog.

Usingpg_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 toFull 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 specialPTRACK bitmap for this relation. As one page requires just one bit in thePTRACK 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 withpg_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 support provided via following options:

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

Limitations

pg_probackup currently has the following limitations:

  • The server from which the backup was taken and the restored server must be compatible by theblock_size andwal_block_size parameters and have the same major release number.
  • Remote mode is in beta stage.
  • Incremental chain can span only within one timeline. So if you have backup incremental chain taken from replica and it gets promoted, you would be forced to take another FULL backup.

Installation and Setup

Windows Installation

Installers download link

Linux Installation

#DEB Ubuntu|Debian Packagesecho"deb [arch=amd64] http://repo.postgrespro.ru/pg_probackup/deb/$(lsb_release -cs) main-$(lsb_release -cs)"> /etc/apt/sources.list.d/pg_probackup.listwget -O - http://repo.postgrespro.ru/pg_probackup/keys/GPG-KEY-PG_PROBACKUP| apt-key add -&& apt-get updateapt-get install pg-probackup-{11,10,9.6,9.5}apt-get install pg-probackup-{11,10,9.6,9.5}-dbg#DEB-SRC Packagesecho"deb-src [arch=amd64] http://repo.postgrespro.ru/pg_probackup/deb/$(lsb_release -cs) main-$(lsb_release -cs)">>\  /etc/apt/sources.list.d/pg_probackup.listapt-getsource pg-probackup-{11,10,9.6,9.5}#RPM Centos Packagesrpm -ivh http://repo.postgrespro.ru/pg_probackup/keys/pg_probackup-repo-centos.noarch.rpmyum install pg_probackup-{11,10,9.6,9.5}yum install pg_probackup-{11,10,9.6,9.5}-debuginfo#RPM RHEL Packagesrpm -ivh http://repo.postgrespro.ru/pg_probackup/keys/pg_probackup-repo-rhel.noarch.rpmyum install pg_probackup-{11,10,9.6,9.5}yum install pg_probackup-{11,10,9.6,9.5}-debuginfo#RPM Oracle Linux Packagesrpm -ivh http://repo.postgrespro.ru/pg_probackup/keys/pg_probackup-repo-oraclelinux.noarch.rpmyum install pg_probackup-{11,10,9.6,9.5}yum install pg_probackup-{11,10,9.6,9.5}-debuginfo#SRPM Packagesyumdownloader --source pg_probackup-{11,10,9.6,9.5}

Once you havepg_probackup installed, completethe setup.

Building from source

Linux

To compilepg_probackup, you must have a PostgreSQL installation and raw source tree. To installpg_probackup, execute this in the module's directory:

make USE_PGXS=1 PG_CONFIG=<path_to_pg_config> top_srcdir=<path_to_PostgreSQL_source_tree>

Windows

Currently pg_probackup can be build using only MSVC 2013.Build PostgreSQL usingpgwininstall orPostgreSQL instruction with MSVC 2013.If zlib support is needed, src/tools/msvc/config.pl must contain path to directory with compiled zlib.Example

CALL"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall" amd64SET PATH=%PATH%;C:\Perl64\binSET PATH=%PATH%;C:\msys64\usr\bingen_probackup_project.pl C:\path_to_postgresql_source_tree

Current release

2.1.3

Documentation

Currently the latest documentation can be found atPostgres Pro Enterprise documentation.

Licence

This module available under thelicense similar toPostgreSQL.

Feedback

Do not hesitate to post your issues, questions and new ideas at theissues page.

Authors

Postgres Professional, Moscow, Russia.

Credits

pg_probackup utility is based onpg_arman, that was originally written by NTT and then developed and maintained by Michael Paquier.


[8]ページ先頭

©2009-2025 Movatter.jp