<div dir="ltr"><div>[1-1] 2020-12-17 17:23:59: pid 9732: LOG:  reading status file: 0 th backend is set to down status  <--- I think this is the problem</div><div><br></div><div>Now I just need to find the file location.<br></div><div><br></div><div>Regards,</div><div>LA<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 17, 2020 at 4:19 PM Luís Alves <<a href="mailto:luisalves00@gmail.com">luisalves00@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>is there any file that store the index of the primary node?</div><div><br></div><div>Regards,<br></div><div>LA<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 17, 2020 at 3:56 PM Luís Alves <<a href="mailto:luisalves00@gmail.com" target="_blank">luisalves00@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>The problem is not the recovery node index. Now I have:</div><div><br></div><div>pcp_recovery_node -w -h 10.230.4.148 -p 9898 -U pgpool -n 1<br></div><div><br></div><div>(I'm going to try to delay this action on ansible, as pgpool might not have enough time to find the primary node)<br></div><div><br>Then:</div><div><br></div><div>-bash-4.2$ psql -h 10.230.4.148 -p 9999 -U pgpool postgres -c "show pool_nodes"<br>psql: FATAL:  failed to create a backend 1 connection<br>DETAIL:  not executing failover because failover_on_backend_error is off<br><br></div><div>checking node 0:<br></div><div><br>-bash-4.2$ pcp_node_info -w -h 10.3.84.4 -p 9898 -U pgpool -n 0<br>ERROR: connection to host "10.3.84.4" failed with error "Connection refused"   <br></div><div><br></div><div>But the server is running:<br></div><div><br>qs-auth-01 ~]# service postgresql-11 status<br>Redirecting to /bin/systemctl status postgresql-11.service<br>● postgresql-11.service - PostgreSQL 11 database server<br>   Loaded: loaded (/usr/lib/systemd/system/postgresql-11.service; disabled; vendor preset: disabled)<br>  Drop-In: /etc/systemd/system/postgresql-11.service.d<br>           └─override.conf<br>   Active: active (running) since Thu 2020-12-17 16:43:48 CET; 8min ago</div><div><br></div><div>but pgpool is only looking into 
qs-auth-02 (which is node index 1) <br></div><div><br></div><div>Any ideas?</div><div><br></div><div>Regards,</div><div>LA<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 17, 2020 at 1:41 PM Luís Alves <<a href="mailto:luisalves00@gmail.com" target="_blank">luisalves00@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I'm doing the initial installation using Ansible. <br></div><div>I think the problem was that on the initial installation where node 0 (qs-auth-01.dc.internal) should be the primary I was executing:</div><div><br></div><div>pcp_recovery_node -w -h {{ delegate_virtual_ip }} -p 9898 -U pgpool -n 0</div><div><br></div><div>instead of <br></div><div><br></div><div>
<div>pcp_recovery_node -w -h {{ delegate_virtual_ip }} -p 9898 -U pgpool -n 1</div><div><br></div><div>because my node index calculation had a bug.</div><div>I'll check it out during this afternoon and I'll update the thread if the problem persists.</div><div><br></div><div>Regards,</div><div>LA<br></div></div><div> <br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 17, 2020 at 12:21 PM Tatsuo Ishii <<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> Now they are correct and it can connect. Nevertheless, I'm having<br>
> other issues. Here is the Backend Connection Settings<br>
> <br>
> <br>
> # - Backend Connection Settings -<br>
> backend_hostname0 = 'qs-auth-01.dc.internal'<br>
> backend_port0 = 5432<br>
> backend_weight0 = 1<br>
> backend_data_directory0 = '/export/pgsql/data'<br>
> backend_flag0 = 'ALLOW_TO_FAILOVER'<br>
> backend_application_name0 = 'qs-auth-01.dc.internal'<br>
> backend_hostname1 = 'qs-auth-02.dc. internal '<br>
> backend_port1 = 5432<br>
> backend_weight1 = 1<br>
> backend_data_directory1 = '/export/pgsql/data'<br>
> backend_flag1 = 'ALLOW_TO_FAILOVER'<br>
> backend_application_name1 = 'qs-auth-02.dc.internal'<br>
> <br>
> <br>
> node qs-auth-01.dc.internal should be the primary and has postgres running<br>
> there, but pgpool seems to ignore it.<br>
> node qs-auth-02.dc.internal is shutdown as I want to apply replication from<br>
> node 1.<br>
> <br>
> Here is the log:<br>
><br>
> Dec 17 09:18:32 qs-auth-02 pgpool[20471]: [915-1] 2020-12-17 09:18:32: pid<br>
> 20471: ERROR:  failed to make persistent db connection<br>
> Dec 17 09:18:32 qs-auth-02 pgpool[20471]: [915-2] 2020-12-17 09:18:32: pid<br>
> 20471: DETAIL:  connection to host:"qs-auth-02.dc.internal:5432" failed<br>
> Dec 17 09:18:32 qs-auth-02 pgpool[20471]: [916-1] 2020-12-17 09:18:32: pid<br>
> 20471: LOG:  health check retrying on DB node: 1 (round:2)<br>
> Dec 17 09:18:33 qs-auth-02 pgpool[20471]: [917-1] 2020-12-17 09:18:33: pid<br>
> 20471: LOG:  failed to connect to PostgreSQL server on<br>
> "qs-auth-02.dc.internal:5432", getsockopt() detected error "Connection<br>
> refused"<br>
> Dec 17 09:18:33 qs-auth-02 pgpool[20471]: [918-1] 2020-12-17 09:18:33: pid<br>
> 20471: ERROR:  failed to make persistent db connection<br>
> Dec 17 09:18:33 qs-auth-02 pgpool[20471]: [918-2] 2020-12-17 09:18:33: pid<br>
> 20471: DETAIL:  connection to host:"qs-auth-02.dc.internal:5432" failed<br>
> Dec 17 09:18:33 qs-auth-02 pgpool[20471]: [919-1] 2020-12-17 09:18:33: pid<br>
> 20471: LOG:  health check retrying on DB node: 1 (round:3)<br>
> Dec 17 09:18:34 qs-auth-02 pgpool[20471]: [920-1] 2020-12-17 09:18:34: pid<br>
> 20471: LOG:  failed to connect to PostgreSQL server on<br>
> "qs-auth-02.dc.internal:5432", getsockopt() detected error "Connection<br>
> refused"<br>
> <br>
> I see nothing in the node qs-auth-01.dc.internal postgres logs. Is there<br>
> another place where pgpool looks to find postgres servers?<br>
<br>
Probably pgpool recognizes backend_hostname0 (qs-auth-01.dc.internal)<br>
as in "down" or "unused" status.  You can verify it by executing "show<br>
pool_nodes" from psql command connecting to pgpool.<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" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>