pgpool_recovery

pgpool_recovery

pgpool : recovery functions for pgpool-II for V4.3

Overview

ID Extension Package Version Category License Language
5910
pgpool_recovery
pgpool
4.7.1
ADMIN
PostgreSQL
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
----d--
No
No
No
Yes
no
no
Relationships
See Also
pgautofailover
pglogical
pg_failover_slots
repmgr
pg_repack
pg_rewrite
Siblings
pgpool_adm
pgpool_regclass

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PGDG
4.7.1
18
17
16
15
14
pgpool -
RPM
PGDG
4.7.1
18
17
16
15
14
pgpool-II-pg$v-extensions -
DEB
PGDG
4.7.1
18
17
16
15
14
postgresql-$v-pgpool2 -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
el8.aarch64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
el9.x86_64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
el9.aarch64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
el10.x86_64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
el10.aarch64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
d12.x86_64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
d12.aarch64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
d13.x86_64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
d13.aarch64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
u22.x86_64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
u22.aarch64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
u24.x86_64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
u24.aarch64
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1
PGDG 4.7.1

Source

Install

Make sure PGDG repo available:

pig repo add pgdg -u    # add pgdg repo and update cache

Install this extension with pig:

pig install pgpool;		# install via package name, for the active PG version
pig install pgpool_recovery;		# install by extension name, for the current active PG version

pig install pgpool_recovery -v 18;   # install for PG 18
pig install pgpool_recovery -v 17;   # install for PG 17
pig install pgpool_recovery -v 16;   # install for PG 16
pig install pgpool_recovery -v 15;   # install for PG 15
pig install pgpool_recovery -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION pgpool_recovery;

Usage

pgpool_recovery: recovery functions for pgpool-II

The pgpool_recovery extension provides recovery-related functions used by Pgpool-II for online recovery of backend PostgreSQL nodes.

Functions

-- Trigger online recovery of a backend node
-- Executes the recovery script on the primary node
SELECT pgpool_recovery(
    'recovery_1st_stage_script',   -- script name in $PGDATA
    'target_hostname',             -- hostname of node to recover
    'target_pgdata',               -- data directory on target
    'target_port'                  -- port number on target
);

-- Second stage recovery (optional, for streaming replication)
SELECT pgpool_remote_start(
    'target_hostname',             -- hostname of recovered node
    'target_pgdata'                -- data directory on target
);

-- Check if the target node is ready
SELECT pgpool_pgctl('status', 'target_pgdata');

How It Works

  1. Pgpool-II calls pgpool_recovery() on the primary node, which executes a user-defined shell script to perform base backup and setup
  2. The recovery script copies data to the target node and configures replication
  3. pgpool_remote_start() starts the recovered PostgreSQL instance
  4. Pgpool-II attaches the recovered node back into the pool

Recovery Scripts

The recovery script (e.g., recovery_1st_stage) must be placed in the primary node’s $PGDATA directory. It typically performs:

  • pg_basebackup to copy data to the target
  • Configuration of primary_conninfo for streaming replication
  • Creation of standby.signal on the target

The extension must be installed on all PostgreSQL backend nodes managed by Pgpool-II.

Last updated on