Backup & Restore

Point-in-Time Recovery (PITR) Backup and Restore

Pigsty uses pgBackRest to manage PostgreSQL backups, arguably the most powerful open-source backup tool in the ecosystem. It supports incremental/parallel backup and restore, encryption, MinIO/S3, and many other features. Pigsty configures backup functionality by default for each PGSQL cluster.

SectionContent
MechanismBackup scripts, cron jobs, pgbackrest, repository and management
PolicyBackup strategy, disk planning, recovery window tradeoffs
RepositoryConfiguring backup repositories: local, MinIO, S3
AdminCommon backup management commands
RestoreRestore to a specific point in time using playbooks
ExampleSandbox example: performing restore operations manually

Quick Start

  1. Backup Policy: Schedule base backups using Crontab
  2. WAL Archiving: Continuously record write activity
  3. Restore & Recovery: Recover from backups and WAL archives
node_crontab: [ '00 01 * * * postgres /pg/bin/pg-backup full' ]
./pgsql-pitr.yml -e '{"pg_pitr": { "time": "2025-07-13 10:00:00+00" }}'

Backup Policy

Design backup policies according to your needs

Backup Mechanism

Backup scripts, cron jobs, backup repository and infrastructure

Backup Repository

PostgreSQL backup storage repository configuration

Admin Commands

Managing backup repositories and backups

Restore Operations

Restore PostgreSQL from backups

Clone Database Cluster

How to use PITR to create a new PostgreSQL cluster and restore to a specified point in time?

Instance Recovery

Clone instances and perform point-in-time recovery on the same machine

Clone Database

How to clone an existing database within a PostgreSQL cluster using instant XFS cloning

Manual Recovery

Manually perform PITR following prompt scripts in sandbox environment


Last Modified 2026-01-09: add supabase asciinema demo (693cfa8)