This document demonstrates pgpool-II for replication and high availability of PostgreSQL databases. It shows:
1. A basic configuration with a master and standby node replicating over pgpool-II for online recovery and load balancing.
2. How pgpool-II can be configured for warm standby replication with automatic failover through scripting.
3. That pgpool-II allows scaling out additional database nodes without downtime and prevents single points of failure through multi-master replication across multiple pgpool instances.
8. 2nd stage script
• Archive a current XLOG.
#! /bin/sh
# Archive a current xlog.
psql -c 'select pg_switch_xlog()' postgres
8
9. pgpool_remote_start
• Script for starting up PostgreSQL
– The first argument is a recovery target name.
– The second argument is a recovery target’s
PGDATA
#! /bin/sh
DEST=$1
DESTDIR=$2
PGCTL=/home/y-asaba/bin/pg_ctl
$PGCTL -w -D $DESTDIR start
9
10. Scale up
• Add a new backend node without stopping
pgpool.
pgpool-II
(port 9999)
PostgreSQL 8.3.1 PostgreSQL 8.3.1 PostgreSQL 8.3.1
(port 5432) (port 5433) (port 5434)
10