<div dir="ltr">Hi Mr Peng!<br><br>regarding your latest commit:<br><div><br><a href="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=blob;f=src/sample/scripts/replication_mode_recovery_1st_stage.sample;h=300c30395f9bb51bd15948e3af177d59fb9142fc;hb=7ed589de5f608eabe4c0d8026f9adcce1eedd015">https://git.postgresql.org/gitweb/?p=pgpool2.git;a=blob;f=src/sample/scripts/replication_mode_recovery_1st_stage.sample;h=300c30395f9bb51bd15948e3af177d59fb9142fc;hb=7ed589de5f608eabe4c0d8026f9adcce1eedd015</a><br><br></div><div><b>1) </b>Is it also applicable to snapshot mode as well? It seems to register standby here as a stream replication of the primary<br><br></div><div><b>2) </b>There is no "pgpass" or "archivedir" in postgresql, at least to my experience:<br><br><span style="color:rgb(255,0,0)">ARCHIVEDIR=/var/lib/pgsql/archivedir</span><br><span style="color:rgb(0,0,255)">    cat > ${RECOVERYCONF} << EOT<br>primary_conninfo = 'host=${MAIN_NODE_HOST} port=${MAIN_NODE_PORT} user=${REPLUSER} application_name=${DEST_NODE_HOST} passfile=''/var/lib/pgsql/<span style="color:rgb(255,0,0)">.pgpass'</span>'' <br>recovery_target_timeline = 'latest'<br>restore_command = 'scp ${SSH_OPTIONS} 
${MAIN_NODE_HOST}:<span style="color:rgb(255,0,0)">${ARCHIVEDIR}
</span>
/%f %p' </span><br><br></div><div><b>3) </b>What does it wait for here? Since it has waited postgresql to finish the replication?<br><br><span style="color:rgb(0,0,255)"># start target server as a streaming replication standby server<br>ssh -T ${SSH_OPTIONS} ${POSTGRESQL_STARTUP_USER}@$DEST_NODE_HOST "<br>  $PGHOME/bin/pg_ctl -l /dev/null <span style="color:rgb(255,0,0)">-w</span> -D $DEST_NODE_PGDATA start<br>"<br># <span style="color:rgb(255,0,0)">wait till the standby catches up primary server</span> or <br># $MAX_DURATION seconds passes<br>sec=0<br>while [ $sec -lt $MAX_DURATION ]<br>do<br>  sec=`expr $sec + 1`<br><br>  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}'" <span style="color:rgb(255,0,0)">postgres</span> | sed -n 3p|sed 's/ //'`<br><br>  echo "result: $result"<br>  if [ "$result" = "t" ];then<br>    sec=$MAX_DURATION<br>  fi<br>  sleep 1<br>done </span><br><br></div><div><b>4)</b> Did you mean <span style="color:rgb(255,0,0)">`-U postgres`</span> in the line beginning with <span style="color:rgb(0,0,255)">`result=`</span> ?<br></div><div><br></div><div>Regards,<br></div><div>  Zhaoxun<br></div><div><br></div><div><br></div></div>