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

Zhaoxun Yan yan.zhaoxun at gmail.com
Tue Jun 13 19:01:26 JST 2023


Hi Bo,

I had been reviewing recovery_1st.sh.sample, and I have a question
regarding these lines:

# 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 start
"

# wait till the standby catches up primary server or
# $MAX_DURATION seconds passes
sec=0
while [ $sec -lt $MAX_DURATION ]
do
  sec=`expr $sec + 1`

If you have chosen wait option "-w" in pg_ctl, it would have finished the
process before executing "wait until standby catches primary" whole block,
so did you mean no wait option "-W" instead?

On Tue, May 30, 2023 at 9:28 PM Bo Peng <pengbo at sraoss.co.jp> wrote:

> Hi,
>
> Thank you for reporting this issue.
>
> It is a Pgpool-II's bug and I have fixed it:
>
>
> https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=7ed589de5f608eabe4c0d8026f9adcce1eedd015
>
> On Tue, 30 May 2023 16:50:33 +0800
> Zhaoxun Yan <yan.zhaoxun at gmail.com> wrote:
>
> > 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/
> > >
>
>
> --
> 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/20230613/c907a0ef/attachment.htm>


More information about the pgpool-general mailing list