<div dir="ltr"><div><div><div><div><div><div>Hi Tatsuo,<br><br></div>this tutorial i tried before using replication mode. But there is one problem i can&#39;t figure.<br><br></div>I have master and slave server but only master is accepting my queries. If i try to create new db by:<br>createdb -p 9999 -U postgres -h localhost DB5 <br></div>on pgpool-II server, i get info below from log but only master create this DB5. If i try to connect by pgpool-II to this new db, i get another info below.<br><br></div>Is there anything i am doing wrong?<br><br></div>PS:<br></div>both are hot_standby and use configuration from manual, only pg_hba.conf is set to specific hosts for trust reading all databases from postgres and also trust replication<br><div><div><br>Thanks,<br>Michal Stava<br><div><div><br>LOG when connecting new DB:<br>2014-12-03 08:55:28: pid 21237: LOG:  pool_read_kind: error message from <br>1 th backend:database &quot;DB5&quot; does not exist<br>2014-12-03 08:55:28: pid 21237: ERROR:  unable to read message kind<br>2014-12-03 08:55:28: pid 21237: DETAIL:  kind does not match between master(53) slot[1] (45)<br><br>LOG when creating new DB:<br>2014-12-03 08:51:03: pid 21153: DEBUG:  I am 21153 accept fd 11<br>2014-12-03 08:51:03: pid 21153: DEBUG:  reading startup packet<br>2014-12-03 08:51:03: pid 21153: DETAIL:  Protocol Major: 1234 Minor: 5679 database:  user: <br>2014-12-03 08:51:03: pid 21153: DEBUG:  selecting backend connection<br>2014-12-03 08:51:03: pid 21153: DETAIL:  SSLRequest from client<br>2014-12-03 08:51:03: pid 21153: DEBUG:  SSL is requested but SSL support is not available<br>2014-12-03 08:51:03: pid 21153: DEBUG:  reading startup packet<br>2014-12-03 08:51:03: pid 21153: DETAIL:  application_name: createdb<br>2014-12-03 08:51:03: pid 21153: DEBUG:  reading startup packet<br>2014-12-03 08:51:03: pid 21153: DETAIL:  Protocol Major: 3 Minor: 0 database: postgres user: postgres<br>2014-12-03 08:51:03: pid 21153: DEBUG:  sending backend key data<br>2014-12-03 08:51:03: pid 21153: DETAIL:  send pid 15378 to frontend<br>2014-12-03 08:51:03: pid 21153: DEBUG:  do_command: Query:&quot;SET application_name TO &#39;createdb&#39;&quot;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  waiting for query response<br>2014-12-03 08:51:03: pid 21153: DETAIL:  waiting for backend:0 to complete the query<br>2014-12-03 08:51:03: pid 21153: DEBUG:  detect error: kind: S<br>2014-12-03 08:51:03: pid 21153: DEBUG:  do_command: kind: &#39;S&#39;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  do_command: kind: &#39;C&#39;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  do_command: kind: &#39;Z&#39;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  do_command: Query:&quot;SET application_name TO &#39;createdb&#39;&quot;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  waiting for query response<br>2014-12-03 08:51:03: pid 21153: DETAIL:  waiting for backend:1 to complete the query<br>2014-12-03 08:51:03: pid 21153: DEBUG:  detect error: kind: S<br>2014-12-03 08:51:03: pid 21153: DEBUG:  do_command: kind: &#39;S&#39;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  do_command: kind: &#39;C&#39;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  do_command: kind: &#39;Z&#39;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  session context: clearing transaction isolation. DONE<br>2014-12-03 08:51:03: pid 21153: DEBUG:  session context: clearing writing transaction. DONE<br>2014-12-03 08:51:03: pid 21153: DEBUG:  session context: clearing failed transaction. DONE<br>2014-12-03 08:51:03: pid 21153: DEBUG:  session context: clearing failed transaction. DONE<br>2014-12-03 08:51:03: pid 21153: DEBUG:  session context: clearing skip reading from backends. DONE<br>2014-12-03 08:51:03: pid 21153: DEBUG:  session context: clearing ignore till sync. DONE<br>2014-12-03 08:51:03: pid 21153: DEBUG:  processing frontend response<br>2014-12-03 08:51:03: pid 21153: DETAIL:  received kind &#39;Q&#39;(51) from frontend<br>2014-12-03 08:51:03: pid 21153: DEBUG:  session context: clearing doing extended query messaging. DONE<br>2014-12-03 08:51:03: pid 21153: DEBUG:  session context: setting query in progress. DONE<br>2014-12-03 08:51:03: pid 21153: DEBUG:  decide where to send the queries<br>2014-12-03 08:51:03: pid 21153: DETAIL:  destination = 0 for query= &quot;CREATE DATABASE &quot;DB5&quot;;<br>    &quot;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  waiting for query response<br>2014-12-03 08:51:03: pid 21153: DETAIL:  waiting for backend:0 to complete the query<br>2014-12-03 08:51:03: pid 21153: DEBUG:  detect error: kind: C<br>2014-12-03 08:51:03: pid 21153: DEBUG:  detect error: kind: C<br>2014-12-03 08:51:03: pid 21153: DEBUG:  detect error: kind: C<br>2014-12-03 08:51:03: pid 21153: DEBUG:  detect error: kind: C<br>2014-12-03 08:51:03: pid 21153: DEBUG:  reading backend data packet kind<br>2014-12-03 08:51:03: pid 21153: DETAIL:  backend:0 of 2 kind = &#39;C&#39;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  processing backend response<br>2014-12-03 08:51:03: pid 21153: DETAIL:  received kind &#39;C&#39;(43) from backend<br>2014-12-03 08:51:03: pid 21153: DEBUG:  session context: setting command success. DONE<br>2014-12-03 08:51:03: pid 21153: DEBUG:  reading backend data packet kind<br>2014-12-03 08:51:03: pid 21153: DETAIL:  backend:0 of 2 kind = &#39;Z&#39;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  processing backend response<br>2014-12-03 08:51:03: pid 21153: DETAIL:  received kind &#39;Z&#39;(5a) from backend<br>2014-12-03 08:51:03: pid 21153: DEBUG:  processing backend response<br>2014-12-03 08:51:03: pid 21153: DETAIL:  Ready For Query received<br>2014-12-03 08:51:03: pid 21153: DEBUG:  reading message length<br>2014-12-03 08:51:03: pid 21153: DETAIL:  slot: 0 length: 5<br>2014-12-03 08:51:03: pid 21153: DEBUG:  processing ReadyForQuery<br>2014-12-03 08:51:03: pid 21153: DETAIL:  transaction state &#39;I&#39;(49)<br>2014-12-03 08:51:03: pid 21153: DEBUG:  processing frontend response<br>2014-12-03 08:51:03: pid 21153: DETAIL:  received kind &#39;X&#39;(58) from frontend<br>2014-12-03 08:51:03: pid 21153: DEBUG:  session context: clearing doing extended query messaging. DONE<br>2014-12-03 08:51:03: pid 21153: LOG:  Frontend terminated<br>2014-12-03 08:51:03: pid 21153: DETAIL:  received message kind &#39;X&#39; from frontend<br>2014-12-03 08:51:03: pid 21153: DEBUG:  session context: setting query in progress. DONE<br>2014-12-03 08:51:03: pid 21153: DEBUG:  decide where to send the queries<br>2014-12-03 08:51:03: pid 21153: DETAIL:  destination = 3 for query= &quot; DISCARD ALL&quot;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  waiting for query response<br>2014-12-03 08:51:03: pid 21153: DETAIL:  waiting for backend:0 to complete the query<br>2014-12-03 08:51:03: pid 21153: DEBUG:  detect error: kind: S<br>2014-12-03 08:51:03: pid 21153: DEBUG:  detect error: kind: S<br>2014-12-03 08:51:03: pid 21153: DEBUG:  detect error: kind: S<br>2014-12-03 08:51:03: pid 21153: DEBUG:  detect error: kind: S<br>2014-12-03 08:51:03: pid 21153: DEBUG:  reading backend data packet kind<br>2014-12-03 08:51:03: pid 21153: DETAIL:  parameter name: is_superuser value: &quot;on&quot;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  reading backend data packet kind<br>2014-12-03 08:51:03: pid 21153: DETAIL:  parameter name: session_authorization value: &quot;postgres&quot;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  reading backend data packet kind<br>2014-12-03 08:51:03: pid 21153: DETAIL:  parameter name: application_name value: &quot;createdb&quot;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  reading backend data packet kind<br>2014-12-03 08:51:03: pid 21153: DETAIL:  backend:0 of 2 kind = &#39;C&#39;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  processing backend response<br>2014-12-03 08:51:03: pid 21153: DETAIL:  received kind &#39;C&#39;(43) from backend<br>2014-12-03 08:51:03: pid 21153: DEBUG:  session context: setting command success. DONE<br>2014-12-03 08:51:03: pid 21153: DEBUG:  reading backend data packet kind<br>2014-12-03 08:51:03: pid 21153: DETAIL:  backend:0 of 2 kind = &#39;Z&#39;<br>2014-12-03 08:51:03: pid 21153: DEBUG:  processing backend response<br>2014-12-03 08:51:03: pid 21153: DETAIL:  received kind &#39;Z&#39;(5a) from backend<br>2014-12-03 08:51:03: pid 21153: DEBUG:  processing backend response<br>2014-12-03 08:51:03: pid 21153: DETAIL:  Ready For Query received<br>2014-12-03 08:51:03: pid 21153: DEBUG:  reading message length<br>2014-12-03 08:51:03: pid 21153: DETAIL:  slot: 0 length: 5<br>2014-12-03 08:51:03: pid 21153: DEBUG:  processing ReadyForQuery<br>2014-12-03 08:51:03: pid 21153: DETAIL:  transaction state &#39;I&#39;(49)<br>2014-12-03 08:51:03: pid 21153: DEBUG:  setting backend connection close timer<br>2014-12-03 08:51:03: pid 21153: DETAIL:  close time 1417593063<br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-12-03 0:05 GMT+01:00 Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">&gt; Hi,<br>
&gt;<br>
&gt; frstly I want to say &quot;Good job, your technology is really good, thank you.&quot;<br>
&gt; and secondly &quot;Sorry for my bad english, I do my best.&quot;<br>
&gt;<br>
&gt; Ok, so what&#39;s my problem:<br>
&gt;<br>
&gt; I created replication model for my application (1 server with pgpool2<br>
&gt; instance and 2 servers like host0 and host1). Everything is ok except<br>
&gt; online_recovery part which I really have problem to understand.<br>
&gt;<br>
&gt; For now I have 3 empty scripts so adding node works, but there is no<br>
&gt; sychronization of DBs:<br>
&gt; basebackup<br>
&gt; pgpool_recovery_pitr<br>
&gt; pgpool_remote_start<br>
&gt;<br>
&gt;<br>
&gt; There is a sample of basebackup script:<br>
&gt;<br>
&gt; #! /bin/sh<br>
&gt; DATA=$1<br>
&gt; RECOVERY_TARGET=$2<br>
&gt; RECOVERY_DATA=$3<br>
&gt; psql -c &quot;select pg_start_backup(&#39;pgpool-recovery&#39;)&quot;<br>
&gt; postgres echo &quot;restore_command = &#39;scp $HOSTNAME:/data/archive_log/%f<br>
&gt; %p&#39;&quot; &gt; /data/recovery.conf<br>
&gt; tar -C /data -zcf pgsql.tar.gz pgsql<br>
&gt; psql -c &#39;select pg_stop_backup()&#39; postgres<br>
&gt; scp pgsql.tar.gz $RECOVERY_TARGET:$RECOVERY_DATA<br>
&gt;<br>
&gt; I really need some advices there, because can&#39;t understand it.<br>
&gt;<br>
&gt; 1] there is something like /data/ so its $DATA or its other data?<br>
&gt; 2] there is tar on pgsql in data directory, but i have no pgsql directory<br>
&gt; there<br>
&gt; 3] do you have some working example? not only common sample?<br>
&gt; 4] very similar problem I have with other two scripts<br>
&gt;<br>
&gt; Last 2 days I spent many hours by trying to understand this online recovery<br>
&gt; mechanism, but<br>
&gt; my karma is probably too low.<br>
&gt;<br>
&gt; Thank you for any advice,<br>
&gt; Michal Stava,<br>
&gt; CZECH REPUBLIC<br>
<br>
</div></div>I recommend to start with this tutorial:<br>
<br>
<a href="http://www.pgpool.net/pgpool-web/contrib_docs/simple_sr_setting2_3.3/index.html" target="_blank">http://www.pgpool.net/pgpool-web/contrib_docs/simple_sr_setting2_3.3/index.html</a><br>
<br>
Best regards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese:<a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
</blockquote></div><br></div>