<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:14pt"><div style="RIGHT: auto"><SPAN style="RIGHT: auto">Dear Tatsuo,</SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN>&nbsp;</div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 19px; RIGHT: auto"><SPAN style="RIGHT: auto">&nbsp;&nbsp;&nbsp;&nbsp; The error e1012 popped up on the third try&nbsp;once again on my two physical systems and the basebackup.log says the following</SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 19px; RIGHT: auto"><SPAN style="RIGHT: auto">*************************</SPAN></div><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" lang=EN>
<div>/usr/local/pgsql/data/basebackup.sh: line 12: psql: command not found</div>
<div>rsync: failed to set times on "/usr/local/pgsql/data/basebackup.sh": Operation not permitted (1)</div>
<div style="RIGHT: auto">rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]</div>
<div>/usr/local/pgsql/data/basebackup.sh: line 34: psql: command not found</div></SPAN></SPAN>
<DIV style="RIGHT: auto">***********************</DIV>
<DIV style="RIGHT: auto">&nbsp;</DIV>
<DIV style="RIGHT: auto">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The same worked fine for my earlier&nbsp;virtual machines with same configuration and no error e1012 popped up the third time after applying the "rm -rf pg_xlog" line.</DIV>
<DIV style="RIGHT: auto">&nbsp;</DIV>
<DIV style="RIGHT: auto">&nbsp;&nbsp;&nbsp;&nbsp; Kindly help me on this unique issue i have checked the server time of both postgres database they are almost same only 1 to 2 sec apart.</DIV>
<DIV style="RIGHT: auto">&nbsp;</DIV>
<DIV style="RIGHT: auto">Thanks and Regards,</DIV>
<div style="RIGHT: auto">Syed Irfan.</div>
<div style="RIGHT: auto">Sr. Developer<BR><BR style="RIGHT: auto"></div>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 14pt">
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV dir=ltr>
<DIV style="BORDER-BOTTOM: #ccc 1px solid; BORDER-LEFT: #ccc 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 0; MARGIN: 5px 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; HEIGHT: 0px; FONT-SIZE: 0px; BORDER-TOP: #ccc 1px solid; BORDER-RIGHT: #ccc 1px solid; PADDING-TOP: 0px" class=hr contentEditable=false readonly="true"></DIV><FONT size=2 face=Arial><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Tatsuo Ishii &lt;ishii@postgresql.org&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> syedirfan_77@yahoo.com <BR><B><SPAN style="FONT-WEIGHT: bold">Cc:</SPAN></B> pgpool-general@pgpool.net <BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Thursday, 30 January 2014 5:20 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [pgpool-general: 2475] Help error code e1012 on pgpool II 3.3.0 while clicking Recovery button<BR></FONT></DIV>
<DIV class=y_msg_container><BR>It seems the cause of your problem is apparently this:<BR clear=none><BR clear=none>&gt; /usr/local/pgsql/data/basebackup.sh: line 33: psql: command not found<BR clear=none><BR clear=none>Please fix it.<BR clear=none><BR clear=none>Best regards,<BR clear=none>--<BR clear=none>Tatsuo Ishii<BR clear=none>SRA OSS, Inc. Japan<BR clear=none>English: <A href="http://www.sraoss.co.jp/index_en.php" shape=rect target=_blank>http://www.sraoss.co.jp/index_en.php</A><BR clear=none>Japanese: <A href="http://www.sraoss.co.jp/" shape=rect target=_blank>http://www.sraoss.co.jp/</A> 
<DIV id=yqtfd05782 class=yqt8830855540><BR clear=none><BR clear=none>&gt; Dear Tatsuo,<BR clear=none>&gt; <BR clear=none>&gt; &nbsp; &nbsp; &nbsp; Thanks for your reply, I have followed your recommendations and this time the errorcode e1012 pops up not on the third try but on the second try and&nbsp;within 2 seconds of clicking the recovery button.&nbsp;<BR clear=none>&gt; <BR clear=none>&gt; First Try of Recovery button when primary was down<BR clear=none>&gt; Recovery success on 172.16.80.49(when it was down manually) the backup log of 172.16.80.47 is as follows<BR clear=none>&gt; <BR clear=none>&gt; ******************************************************************<BR clear=none>&gt; &nbsp;pg_start_backup&nbsp;<BR clear=none>&gt; -----------------<BR clear=none>&gt; &nbsp;1/3C000020<BR clear=none>&gt; (1 row)<BR clear=none>&gt; <BR clear=none>&gt; mkdir: cannot create directory `/usr/local/pgsql/data/pg_xlog': File exists<BR clear=none>&gt; NOTICE:
 &nbsp;WAL archiving is not enabled; you must ensure that all required WAL segments are copied through other means to complete the backup<BR clear=none>&gt; &nbsp;pg_stop_backup&nbsp;<BR clear=none>&gt; ----------------<BR clear=none>&gt; &nbsp;1/3C0000D8<BR clear=none>&gt; (1 row)<BR clear=none>&gt; ******************************************************************<BR clear=none>&gt; <BR clear=none>&gt; Second Try of Recovery button when the new primary was down manually<BR clear=none>&gt; Recovery fails on 172.16.80.47(when it was down manually) the backup log of 172.16.80.49 is as follows<BR clear=none>&gt; <BR clear=none>&gt; ******************************************************************<BR clear=none>&gt; /usr/local/pgsql/data/basebackup.sh: line 12: psql: command not found<BR clear=none>&gt; mkdir: cannot create directory `/usr/local/pgsql/data/pg_xlog': File exists<BR clear=none>&gt; /usr/local/pgsql/data/basebackup.sh: line 33: psql: command
 not found<BR clear=none>&gt; ******************************************************************<BR clear=none>&gt; <BR clear=none>&gt; The basebackup.sh on both servers is as follows with the added script for basebackup.log and uncommented recovery_target_timeline = 'latest'<BR clear=none>&gt; <BR clear=none>&gt; *******************************************************************<BR clear=none>&gt; #/bin/sh -x<BR clear=none>&gt; exec &gt; /tmp/basebackup.log 2&gt;&amp;1<BR clear=none>&gt; # XXX We assume master and recovery host uses the same port number<BR clear=none>&gt; PORT=5432<BR clear=none>&gt; master_node_host_name=`hostname`<BR clear=none>&gt; master_db_cluster=$1<BR clear=none>&gt; recovery_node_host_name=$2<BR clear=none>&gt; recovery_db_cluster=$3<BR clear=none>&gt; tmp=/tmp/mytemp$$<BR clear=none>&gt; trap "rm -f $tmp" 0 1 2 3 15<BR clear=none>&gt; <BR clear=none>&gt; psql -p $PORT -c "SELECT pg_start_backup('Streaming Replication', true)"
 postgres<BR clear=none>&gt; <BR clear=none>&gt; rsync -C -a -c --delete --exclude postgresql.conf --exclude postmaster.pid \<BR clear=none>&gt; --exclude postmaster.opts --exclude pg_log \<BR clear=none>&gt; --exclude recovery.conf --exclude recovery.done \<BR clear=none>&gt; --exclude pg_xlog \<BR clear=none>&gt; $master_db_cluster/ $recovery_node_host_name:$recovery_db_cluster<BR clear=none>&gt; <BR clear=none>&gt; ssh -T $recovery_node_host_name mkdir $recovery_db_cluster/pg_xlog<BR clear=none>&gt; ssh -T $recovery_node_host_name chmod 700 $recovery_db_cluster/pg_xlog<BR clear=none>&gt; ssh -T $recovery_node_host_name rm -f $recovery_db_cluster/recovery.done<BR clear=none>&gt; <BR clear=none>&gt; cat &gt; $tmp &lt;&lt;EOF<BR clear=none>&gt; recovery_target_timeline = 'latest'<BR clear=none>&gt; standby_mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 'on'<BR clear=none>&gt; primary_conninfo &nbsp; &nbsp; &nbsp;= 'host=$master_node_host_name port=$PORT
 user=postgres'<BR clear=none>&gt; trigger_file = '/var/log/pgpool/trigger/trigger_file1'<BR clear=none>&gt; EOF<BR clear=none>&gt; <BR clear=none>&gt; scp $tmp $recovery_node_host_name:$recovery_db_cluster/recovery.conf<BR clear=none>&gt; <BR clear=none>&gt; psql -p $PORT -c "SELECT pg_stop_backup()" postgres<BR clear=none>&gt; *******************************************************************<BR clear=none>&gt; <BR clear=none>&gt; &nbsp; &nbsp; &nbsp; &nbsp;<BR clear=none>&gt; &nbsp; &nbsp; &nbsp;Also, the reason for commenting (recovery_target_timeline = 'latest') was it was not mentioned in your "Simple Streaming replication setting with&nbsp;pgpool-II(multiple servers version)" <A href="http://www.pgpool.net/pgpool-web/contrib_docs/simple_sr_setting2_3.0/" shape=rect target=_blank>http://www.pgpool.net/pgpool-web/contrib_docs/simple_sr_setting2_3.0/</A>page.&nbsp;<BR clear=none>&gt; &nbsp; &nbsp; &nbsp;But after a long search on the net i found
 someone adding the line (recovery_target_timeline = 'latest') so for test purpose i have added it and once it did&nbsp;not solve the purpose I had commented it.<BR clear=none>&gt; <BR clear=none>&gt; &nbsp; &nbsp; &nbsp;Request you to help on the issue ASAP.<BR clear=none>&gt; <BR clear=none>&gt; Best Regards,<BR clear=none>&gt; Syed Irfan<BR clear=none>&gt; Sr Developer<BR clear=none>&gt; <BR clear=none>&gt; &nbsp;<BR clear=none>&gt; Thanks and Regards,<BR clear=none>&gt; Syed Irfan.<BR clear=none>&gt; <BR clear=none>&gt; Sr. Developer<BR clear=none>&gt; <BR clear=none>&gt; <BR clear=none>&gt; <BR clear=none>&gt; <BR clear=none>&gt; <BR clear=none>&gt; On Tuesday, 28 January 2014 4:52 AM, Tatsuo Ishii &lt;<A href="mailto:ishii@postgresql.org" shape=rect ymailto="mailto:ishii@postgresql.org">ishii@postgresql.org</A>&gt; wrote:<BR clear=none>&gt;&nbsp; <BR clear=none>&gt;&gt; This is what the recovery.conf looks like.<BR clear=none>&gt;&gt;
 *******************************************<BR clear=none>&gt;&gt; #recovery_target_timeline = 'latest'<BR clear=none>&gt;&gt; standby_mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 'on'<BR clear=none>&gt;&gt; primary_conninfo &nbsp; &nbsp; &nbsp;= 'host=postgres-p.rolta.com port=5432 user=postgres'<BR clear=none>&gt;&gt; trigger_file = '/var/log/pgpool/trigger/trigger_file1'<BR clear=none>&gt;&gt; ********************************************************<BR clear=none>&gt; <BR clear=none>&gt; Why did you remove "recovery_target_timeline = 'latest'"?<BR clear=none>&gt; <BR clear=none>&gt; I suggesto to take an execution log of script. You change the very<BR clear=none>&gt; begging of the script:<BR clear=none>&gt; <BR clear=none>&gt; #/bin/sh -x<BR clear=none>&gt; <BR clear=none>&gt; to:<BR clear=none>&gt; <BR clear=none>&gt; #/bin/sh -x<BR clear=none>&gt; exec &gt; /tmp/basebackup.log 2&gt;&amp;1<BR clear=none>&gt; <BR clear=none>&gt; and please show us the
 content of /tmp/basebackup.log after execution of pcp_recovery_node.<BR clear=none>&gt; <BR clear=none>&gt; Best regards,<BR clear=none>&gt; --<BR clear=none>&gt; Tatsuo Ishii<BR clear=none>&gt; SRA OSS, Inc. Japan<BR clear=none>&gt; English: <A href="http://www.sraoss.co.jp/index_en.php" shape=rect target=_blank>http://www.sraoss.co.jp/index_en.php</A><BR clear=none>&gt; Japanese: <A href="http://www.sraoss.co.jp/" shape=rect target=_blank>http://www.sraoss.co.jp/</A><BR clear=none>&gt; <BR clear=none>&gt; <BR clear=none>&gt; <BR clear=none>&gt;&gt; The basebackup.sh on both postgres databases is as follows<BR clear=none>&gt;&gt; **************************************************<BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; #/bin/sh -x<BR clear=none>&gt;&gt; #<BR clear=none>&gt;&gt; # XXX We assume master and recovery host uses the same port number<BR clear=none>&gt;&gt; PORT=5432<BR clear=none>&gt;&gt; master_node_host_name=`hostname`<BR
 clear=none>&gt;&gt; master_db_cluster=$1<BR clear=none>&gt;&gt; recovery_node_host_name=$2<BR clear=none>&gt;&gt; recovery_db_cluster=$3<BR clear=none>&gt;&gt; tmp=/tmp/mytemp$$<BR clear=none>&gt;&gt; trap "rm -f $tmp" 0 1 2 3 15<BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; psql -p $PORT -c "SELECT pg_start_backup('Streaming Replication', true)" postgres<BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; rsync -C -a -c --delete --exclude postgresql.conf --exclude postmaster.pid \<BR clear=none>&gt;&gt; --exclude postmaster.opts --exclude pg_log \<BR clear=none>&gt;&gt; --exclude recovery.conf --exclude recovery.done \<BR clear=none>&gt;&gt; --exclude pg_xlog \<BR clear=none>&gt;&gt; $master_db_cluster/ $recovery_node_host_name:$recovery_db_cluster<BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; ssh -T $recovery_node_host_name mkdir $recovery_db_cluster/pg_xlog<BR clear=none>&gt;&gt; ssh -T $recovery_node_host_name chmod 700 $recovery_db_cluster/pg_xlog<BR
 clear=none>&gt;&gt; ssh -T $recovery_node_host_name rm -f $recovery_db_cluster/recovery.done<BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; cat &gt; $tmp &lt;&lt;EOF<BR clear=none>&gt;&gt; #recovery_target_timeline = 'latest'<BR clear=none>&gt;&gt; standby_mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 'on'<BR clear=none>&gt;&gt; primary_conninfo &nbsp; &nbsp; &nbsp;= 'host=$master_node_host_name port=$PORT user=postgres'<BR clear=none>&gt;&gt; trigger_file = '/var/log/pgpool/trigger/trigger_file1'<BR clear=none>&gt;&gt; EOF<BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; scp $tmp $recovery_node_host_name:$recovery_db_cluster/recovery.conf<BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; psql -p $PORT -c "SELECT pg_stop_backup()" postgres<BR clear=none>&gt;&gt; ***********************************************<BR clear=none>&gt;&gt; &nbsp;<BR clear=none>&gt;&gt; Thanks and Regards,<BR clear=none>&gt;&gt; Syed Irfan.<BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt;
 Sr. Developer<BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; On Thursday, 23 January 2014 11:07 PM, Jeff Frost &lt;<A href="mailto:jeff@pgexperts.com" shape=rect ymailto="mailto:jeff@pgexperts.com">jeff@pgexperts.com</A>&gt; wrote:<BR clear=none>&gt;&gt;&nbsp; <BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; On Jan 23, 2014, at 9:32 AM, Syed Irfan &lt;<A href="mailto:syedirfan_77@yahoo.com" shape=rect ymailto="mailto:syedirfan_77@yahoo.com">syedirfan_77@yahoo.com</A>&gt; wrote:<BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; Dear Tatsuo Ishii,<BR clear=none>&gt;&gt;&gt;<BR clear=none>&gt;&gt;&gt;<BR clear=none>&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;I am still awaiting for your reply on this issue, I have tried your suggestions but still I am unable to successfully run the Recovery process the third time it's surprises me how does it work
 the first time but same thing fails in the third attempt.?<BR clear=none>&gt;&gt;&gt;<BR clear=none>&gt;&gt;&gt;<BR clear=none>&gt;&gt;&gt;The Postgres log shows as below<BR clear=none>&gt;&gt;&gt;<BR clear=none>&gt;&gt;&gt;<BR clear=none>&gt;&gt;&gt;<BR clear=none>&gt;&gt;&gt;<BR clear=none>&gt;&gt;&gt;&gt;&gt; 28038 2014-01-09 21:28:33 BDT FATAL:&nbsp; timeline 35 of the primary does not match recovery target timeline 36<BR clear=none>&gt;&gt;&gt;&gt;&gt;&gt; 28039 2014-01-09 21:28:38 BDT FATAL:&nbsp; timeline 35 of the primary does not match recovery target timeline 36<BR clear=none>&gt;&gt;&gt;<BR clear=none>&gt;&gt;&gt;<BR clear=none>&gt;&gt;&gt;<BR clear=none>&gt;&gt;&gt;I urgently request you to help me in this impending issue.<BR clear=none>&gt;&gt;&gt;<BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; This is usually caused by postgres trying to replay WAL files from the wrong source. &nbsp;Did you clean out the pg_xlog directory on the replica
 before taking the base backup?<BR clear=none>&gt;&gt; <BR clear=none>&gt;&gt; What does your recovery.conf look like?</DIV><BR><BR></DIV></DIV></DIV></div></body></html>