[pgpool-general: 8783] Re: Cannot find recovery_2nd_stage.sample

Zhaoxun Yan yan.zhaoxun at gmail.com
Tue May 30 17:50:33 JST 2023


Hi Bo Peng!

I found the variable PORT not defined in the recovery_2nd_stage.sample

#!/bin/bash
# Online recovery 2nd stage script for snapshot mode

set -o xtrace

MAIN_NODE_PGDATA="$1"              # main dabatase cluster
DEST_NODE_HOST="$2"                 # hostname of the DB node to be
recovered
DEST_NODE_PGDATA="$3"              # database cluster of the DB node to be
recovered
MAIN_NODE_PORT="$4"                 # PostgreSQL port number

echo 'recovery_2nd_stage for standby @' $DEST_NODE_HOST

PGHOME=/usr/pgsql-15
ARCHIVEDIR=/var/lib/pgsql/archivedir  # archive log directory
POSTGRESQL_STARTUP_USER=postgres
SSH_KEY_FILE=id_rsa_pgpool
SSH_OPTIONS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i
~/.ssh/${SSH_KEY_FILE}"

# Force to flush current value of sequences to xlog
${PGHOME}/bin/psql -p $PORT -t -c 'SELECT datname FROM pg_database WHERE
NOT datistemplate AND datallowconn' template1|
while read i
do
  if [ "$i" != "" ]; then
    psql -p $PORT -c "SELECT setval(oid, nextval(oid)) FROM pg_class WHERE
relkind = 'S'" $i
  fi
done

psql -p $PORT -c "SELECT pgpool_switch_xlog('$ARCHIVEDIR')" template1

# start target server as a streaming replication standby server
ssh -T ${SSH_OPTIONS} ${POSTGRESQL_STARTUP_USER}@$DEST_NODE_HOST "
        $PGHOME/bin/pg_ctl -l /dev/null -w -D $DEST_NODE_PGDATA promote
"

On Fri, May 19, 2023 at 8:03 AM Bo Peng <pengbo at sraoss.co.jp> wrote:

> Hi,
>
> You can find all the scripts here:
>
> https://git.postgresql.org/gitweb/?p=pgpool2.git;a=tree;f=src/sample/scripts;h=4cd73845f012972d73b24be77911288486bb6c08;hb=refs/heads/V4_4_STABLE
>
> The scripts:
>   replication_mode_recovery_1st_stage.sample
>   replication_mode_recovery_2nd_stage.sample
> are for isolation snapshot mode.
>
> The documetation is wrong and I will fix it.
>
> On Wed, 17 May 2023 16:31:24 +0800
> Zhaoxun Yan <yan.zhaoxun at gmail.com> wrote:
>
> > Hi!
> > I cannot find the recovery_2nd_stage.sample from
> > https://www.pgpool.net/docs/44/en/html/runtime-online-recovery.html. Is
> > there such a file? What does it do when snap-shot mode?
> >
> > Thanks!
> > Zhaoxun
>
>
> --
> Bo Peng <pengbo at sraoss.co.jp>
> SRA OSS LLC
> https://www.sraoss.co.jp/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20230530/7a54173e/attachment.htm>


More information about the pgpool-general mailing list