Thread: Facing issue in online recovery of pgpool-II

Facing issue in online recovery of pgpool-II

From
Saurabh
Date:
Hi all,

I am using postgresql streaming replication for my project. For
automatic failover and online recovery I am trying to use pgpool-II.
Failover is working fine. But in online recovery I am facing issue.
When I am trying to recover master node (which was down earlier) as
slave node then master gets up as master not as slave node. Following
is the configuration

Postgresql.conf (Slave)

wal_level = archive
archive_mode = on
archive_command = 'cp -i %p /home/postgres/archive/%f'
hot_standby = on

Postgresql.conf (Master)

wal_level = hot_standby
archive_mode = on
archive_command = 'cp -i %p /home/postgres/archive/%f'
max_wal_senders = 10
wal_keep_segments = 32
hot_standby = on

Pgpool-II configuration

# online recovery user
recovery_user = 'postgres'

# online recovery password
recovery_password = ''

# execute a command in first stage.
recovery_1st_stage_command = 'basebackup.sh'

# execute a command in second stage.
recovery_2nd_stage_command = ''

Basebackup.sh

psql -p $PORT -c "SELECT pg_start_backup('Streaming Replication',
true)" postgres

rsync -C -a -c --delete --exclude postgresql.conf --exclude
postmaster.pid \
--exclude postmaster.opts --exclude pg_log \
--exclude recovery.conf --exclude recovery.done \
--exclude pg_xlog \
$SOURCE_CLUSTER/ $DEST_CLUSTER/

mkdir $DEST_CLUSTER/pg_xlog
chmod 700 $DEST_CLUSTER/pg_xlog
rm $SOURCE_CLUSTER/recovery.done
#rm $DEST_CLUSTER/pg_hba.conf
cat > $DEST_CLUSTER/recovery.conf <<EOF
standby_mode          = 'on'
primary_conninfo      = 'port=$PORT user=postgres'
trigger_file = '/var/log/pgpool/trigger/trigger_file1'
EOF

psql -p $PORT -c "SELECT pg_stop_backup()" postgres

Please tell me what I am doing wrong.

Thanks

Saurabh Gupta