Overview

PDU provides powerful data recovery capabilities for various PostgreSQL disaster scenarios. Choose the appropriate recovery method based on your situation.

Choose Your Recovery Scenario


Recovery Scenario Comparison

ScenarioRequired ConfigurationData SourceRecovery Speed
Corrupted Data FilePGDATAData file directlyFast
Corrupted InstancePGDATAData file directlySlower
Single Database DirectoryDatabase directory pathDatabase directoryMedium
Deleted RecordsPGDATA + ARCHIVE_DESTWAL archive or checked pg_wal copyFast
Updated RecordsPGDATA + ARCHIVE_DESTWAL archive or checked pg_wal copyFast
Dropped TablesPGDATA + DISK_PATH + PGDATA_EXCLUDEDisk fragment scanningSlower

Quick Start

All recovery operations share a common initialization process. Here's the basic workflow:

1. Configure pdu.ini

vim pdu.ini
#PostgreSQL data directory
PGDATA=/home/pg/data
#WAL source: archive directory or checked copy of PGDATA/pg_wal
ARCHIVE_DEST=/data/pdu-backup/incident/pg_wal
#Disk path (required for DROP TABLE recovery)
DISK_PATH=/dev/mapper/data-lv
#All PostgreSQL data directories on DISK_PATH (required for ds idx)
PGDATA_EXCLUDE=/home/pg/data,/home/pg12/data

If ARCHIVE_DEST points to a copied pg_wal directory, run ckwal; after b; and before any scan or restore command.

2. Start PDU and Initialize

./pdu
 
PDU.public=# b;
 
Initializing...
 -pg_database:</home/pg/data/global/1262>
 
Database:postgres
      -pg_schema:</home/pg/data/base/5/2615>
      -pg_class:</home/pg/data/base/5/1259> Total 82 rows
      Schemas:
 public 10 tables

3. Choose Recovery Method

After initialization, select the appropriate recovery guide from the sidebar based on your scenario.