[pgpool-general: 8831] Questions on Recovery_1st Stage Script

Zhaoxun Yan yan.zhaoxun at gmail.com
Wed Jun 14 12:13:06 JST 2023


Hi Mr Peng!

regarding your latest commit:

https://git.postgresql.org/gitweb/?p=pgpool2.git;a=blob;f=src/sample/scripts/replication_mode_recovery_1st_stage.sample;h=300c30395f9bb51bd15948e3af177d59fb9142fc;hb=7ed589de5f608eabe4c0d8026f9adcce1eedd015

*1) *Is it also applicable to snapshot mode as well? It seems to register
standby here as a stream replication of the primary

*2) *There is no "pgpass" or "archivedir" in postgresql, at least to my
experience:

ARCHIVEDIR=/var/lib/pgsql/archivedir
    cat > ${RECOVERYCONF} << EOT
primary_conninfo = 'host=${MAIN_NODE_HOST} port=${MAIN_NODE_PORT}
user=${REPLUSER} application_name=${DEST_NODE_HOST}
passfile=''/var/lib/pgsql/.pgpass'''
recovery_target_timeline = 'latest'
restore_command = 'scp ${SSH_OPTIONS} ${MAIN_NODE_HOST}:${ARCHIVEDIR} /%f
%p'

*3) *What does it wait for here? Since it has waited postgresql to finish
the replication?

# 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`

  result=`psql -h ${MAIN_NODE_HOST} -p ${MAIN_NODE_PORT} -c "SELECT
sent_lsn = replay_lsn FROM pg_stat_replication where application_name =
'${DEST_NODE_HOST}'" postgres | sed -n 3p|sed 's/ //'`

  echo "result: $result"
  if [ "$result" = "t" ];then
    sec=$MAX_DURATION
  fi
  sleep 1
done

*4)* Did you mean `-U postgres` in the line beginning with `result=` ?

Regards,
  Zhaoxun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20230614/aee623b5/attachment.htm>


More information about the pgpool-general mailing list