<div dir="ltr">Hello.<div>I have followed your instructions and I have configured primary_conninfo of postgresql.conf on both servers.</div><div>Thank you for your support.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 20, 2020 at 1:56 PM Tatsuo Ishii &lt;<a href="mailto:ishii@sraoss.co.jp">ishii@sraoss.co.jp</a>&gt; 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">&gt; Hello<br>
&gt; I don&#39;t had configured application_name in primary_conninfo of<br>
&gt; postgresql.conf.<br>
&gt; I have configured application_name=server2. It&#39;s same value such as<br>
&gt; backend_application_name1<br>
<br>
That doesn&#39;t help. Pgpool-II calls pg_stat_replication function on<br>
PostgreSQL primary, which displays replication state of each standby<br>
server, including replication state, replication sync state and<br>
application name of walreceiver. Walreciver process is executed by<br>
postmaster on standby server. The walreceiver connects to walsender<br>
process of PostgreSQL primary server along with the application name,<br>
which is configured in primary_conninfo. Since Pgpool-II looks for the<br>
output row of pg_stat_replication by using application name as a<br>
key, the application name of walreciver and backend_application_name<br>
must match. That&#39;s the reason why you need to configure application<br>
name in primary_conninfo. In your case primary_conninfo should look<br>
something like:<br>
<br>
primary_conninfo      = &#39;... application_name=&#39;&#39;server1&#39;&#39;&#39; (on server 0)<br>
primary_conninfo      = &#39;... application_name=&#39;&#39;server2&#39;&#39;&#39; (on server 1)<br>
<br>
&gt; Thank you very much.<br>
&gt; <br>
&gt; <br>
&gt; On Mon, Apr 20, 2020 at 10:15 AM Tatsuo Ishii &lt;<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>&gt; wrote:<br>
&gt; <br>
&gt;&gt; Have you set application_name in primary_conninfo of postgresql.conf?<br>
&gt;&gt;<br>
&gt;&gt; &gt; Hello<br>
&gt;&gt; &gt; Thanks for your fast reply.<br>
&gt;&gt; &gt; I have configured these values: backend_application_name0 and<br>
&gt;&gt; &gt; backend_application_name1.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; [root@server1 pgpool-II]# psql -h 172.16.0.1 -p 9999 -U nobody -c<br>
&gt;&gt; &quot;pgpool<br>
&gt;&gt; &gt; show backend_application_name0&quot; postgres<br>
&gt;&gt; &gt;  backend_application_name0<br>
&gt;&gt; &gt; ---------------------------<br>
&gt;&gt; &gt;  server1<br>
&gt;&gt; &gt; (1 row)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; [root@server1 pgpool-II]# psql -h 172.16.0.1 -p 9999 -U nobody -c<br>
&gt;&gt; &quot;pgpool<br>
&gt;&gt; &gt; show backend_application_name1&quot; postgres<br>
&gt;&gt; &gt;  backend_application_name1<br>
&gt;&gt; &gt; ---------------------------<br>
&gt;&gt; &gt;  server2<br>
&gt;&gt; &gt; (1 row)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; [root@server1 pgpool-II]#<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Mon, Apr 20, 2020 at 9:54 AM Tatsuo Ishii &lt;<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>&gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; You need to set application name.<br>
&gt;&gt; &gt;&gt; See<br>
&gt;&gt; <a href="https://www.pgpool.net/pipermail/pgpool-general/2020-April/007022.html" rel="noreferrer" target="_blank">https://www.pgpool.net/pipermail/pgpool-general/2020-April/007022.html</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Best regards,<br>
&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt; 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>
&gt;&gt; &gt;&gt; Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt; Empty values for replication_state and replication_sync_state columns<br>
&gt;&gt; &gt;&gt; with<br>
&gt;&gt; &gt;&gt; &gt; pcp_node_info<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Hello.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; I have testing pgpool 4.1.1 with Postgresql 12.2 on Linux Centos 7.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; I get empty values for replication_state and replication_sync_state<br>
&gt;&gt; &gt;&gt; columns<br>
&gt;&gt; &gt;&gt; &gt; with pcp_node_info or show pool_nodes.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; I have two servers. I have configured Postgresql streaming replication<br>
&gt;&gt; &gt;&gt; and<br>
&gt;&gt; &gt;&gt; &gt; it&#39;s running with success. I get info for replication using sql<br>
&gt;&gt; sentence<br>
&gt;&gt; &gt;&gt; &gt; pg_stat_replication.<br>
&gt;&gt; &gt;&gt; &gt; For pgpool, I have configure backend_application_name0,<br>
&gt;&gt; &gt;&gt; &gt; backend_application_name1, sr_check_period (10) and sr_check_user<br>
&gt;&gt; &gt;&gt; (nobody).<br>
&gt;&gt; &gt;&gt; &gt; Using sr_check_user = postgres I get same results (empty values for<br>
&gt;&gt; &gt;&gt; &gt; replication_state and replication_sync_state columns).<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; What am I doing wrong?<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Then I show some information:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 pgpool-II]# pcp_node_info --host 172.16.0.1 --port 9898<br>
&gt;&gt; &gt;&gt; &gt; --username admin -w --node-id 0<br>
&gt;&gt; &gt;&gt; &gt; 172.16.0.1 5432 2 0.500000 up primary 0   2020-04-20 09:38:04<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 pgpool-II]# pcp_node_info --host 172.16.0.1 --port 9898<br>
&gt;&gt; &gt;&gt; &gt; --username admin -w --node-id 1<br>
&gt;&gt; &gt;&gt; &gt; 172.16.0.2 5432 2 0.500000 up standby 0   2020-04-20 09:38:04<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 pgpool-II]# pcp_node_info --host 172.16.0.1 --port 9898<br>
&gt;&gt; &gt;&gt; &gt; --username admin -w --node-id 0 --verbose<br>
&gt;&gt; &gt;&gt; &gt; Hostname               : 172.16.0.1<br>
&gt;&gt; &gt;&gt; &gt; Port                   : 5432<br>
&gt;&gt; &gt;&gt; &gt; Status                 : 2<br>
&gt;&gt; &gt;&gt; &gt; Weight                 : 0.500000<br>
&gt;&gt; &gt;&gt; &gt; Status Name            : up<br>
&gt;&gt; &gt;&gt; &gt; Role                   : primary<br>
&gt;&gt; &gt;&gt; &gt; Replication Delay      : 0<br>
&gt;&gt; &gt;&gt; &gt; Replication State      :<br>
&gt;&gt; &gt;&gt; &gt; Replication Sync State :<br>
&gt;&gt; &gt;&gt; &gt; Last Status Change     : 2020-04-20 09:38:04<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 pgpool-II]# pcp_node_info --host 172.16.0.1 --port 9898<br>
&gt;&gt; &gt;&gt; &gt; --username admin -w --node-id 1 --verbose<br>
&gt;&gt; &gt;&gt; &gt; Hostname               : 172.16.0.2<br>
&gt;&gt; &gt;&gt; &gt; Port                   : 5432<br>
&gt;&gt; &gt;&gt; &gt; Status                 : 2<br>
&gt;&gt; &gt;&gt; &gt; Weight                 : 0.500000<br>
&gt;&gt; &gt;&gt; &gt; Status Name            : up<br>
&gt;&gt; &gt;&gt; &gt; Role                   : standby<br>
&gt;&gt; &gt;&gt; &gt; Replication Delay      : 0<br>
&gt;&gt; &gt;&gt; &gt; Replication State      :<br>
&gt;&gt; &gt;&gt; &gt; Replication Sync State :<br>
&gt;&gt; &gt;&gt; &gt; Last Status Change     : 2020-04-20 09:38:04<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 pgpool-II]#<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]# psql -h 172.16.0.1 -p 9999 -U nobody -c &quot;select *<br>
&gt;&gt; from<br>
&gt;&gt; &gt;&gt; &gt; pg_stat_replication&quot; postgres<br>
&gt;&gt; &gt;&gt; &gt;  pid  | usesysid |  usename  | application_name | client_addr |<br>
&gt;&gt; &gt;&gt; &gt; client_hostname | client_port |         backend_start         | backen<br>
&gt;&gt; &gt;&gt; &gt; d_xmin |   state   |  sent_lsn  | write_lsn  | flush_lsn  |<br>
&gt;&gt; replay_lsn |<br>
&gt;&gt; &gt;&gt; &gt; write_lag | flush_lag | replay_lag | sync_priority | sync_sta<br>
&gt;&gt; &gt;&gt; &gt; te |          reply_time<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; ------+----------+-----------+------------------+-------------+-----------------+-------------+-------------------------------+-------<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; -------+-----------+------------+------------+------------+------------+-----------+-----------+------------+---------------+---------<br>
&gt;&gt; &gt;&gt; &gt; ---+-------------------------------<br>
&gt;&gt; &gt;&gt; &gt;  3664 |    16384 | userrepli | walreceiver      | 172.16.0.2  |<br>
&gt;&gt; &gt;&gt; &gt;     |       47482 | 2020-04-20 09:10:20.191692+02 |<br>
&gt;&gt; &gt;&gt; &gt;    522 | streaming | 0/19001298 | 0/19001298 | 0/19001298 |<br>
&gt;&gt; 0/19001298 |<br>
&gt;&gt; &gt;&gt; &gt;         |           |            |             0 | async<br>
&gt;&gt; &gt;&gt; &gt;    | 2020-04-20 09:33:32.341974+02<br>
&gt;&gt; &gt;&gt; &gt; (1 row)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]#<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]# pgpool -v<br>
&gt;&gt; &gt;&gt; &gt; pgpool-II version 4.1.1 (karasukiboshi)<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]#<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]# psql -V<br>
&gt;&gt; &gt;&gt; &gt; psql (PostgreSQL) 12.2<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]#<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]# psql -h 172.16.0.1 -p 9999 -U nobody -c &quot;pgpool<br>
&gt;&gt; show<br>
&gt;&gt; &gt;&gt; &gt; sr_check_period&quot; postgres<br>
&gt;&gt; &gt;&gt; &gt;  sr_check_period<br>
&gt;&gt; &gt;&gt; &gt; -----------------<br>
&gt;&gt; &gt;&gt; &gt;  10<br>
&gt;&gt; &gt;&gt; &gt; (1 row)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]# psql -h 172.16.0.1 -p 9999 -U nobody -c &quot;pgpool<br>
&gt;&gt; show<br>
&gt;&gt; &gt;&gt; &gt; sr_check_user&quot; postgres<br>
&gt;&gt; &gt;&gt; &gt;  sr_check_user<br>
&gt;&gt; &gt;&gt; &gt; ---------------<br>
&gt;&gt; &gt;&gt; &gt;  nobody<br>
&gt;&gt; &gt;&gt; &gt; (1 row)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]#<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]# psql -h 172.16.0.1 -p 9999 -U nobody -c &quot;pgpool<br>
&gt;&gt; show<br>
&gt;&gt; &gt;&gt; &gt; backend_application_name0&quot; postgres<br>
&gt;&gt; &gt;&gt; &gt;  backend_application_name0<br>
&gt;&gt; &gt;&gt; &gt; ---------------------------<br>
&gt;&gt; &gt;&gt; &gt;  server1<br>
&gt;&gt; &gt;&gt; &gt; (1 row)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]# psql -h 172.16.0.1 -p 9999 -U nobody -c &quot;pgpool<br>
&gt;&gt; show<br>
&gt;&gt; &gt;&gt; &gt; backend_application_name1&quot; postgres<br>
&gt;&gt; &gt;&gt; &gt;  backend_application_name1<br>
&gt;&gt; &gt;&gt; &gt; ---------------------------<br>
&gt;&gt; &gt;&gt; &gt;  server2<br>
&gt;&gt; &gt;&gt; &gt; (1 row)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]#<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]# psql -h 172.16.0.1 -p 9999 -U nobody -c &quot;show<br>
&gt;&gt; &gt;&gt; pool_nodes&quot;<br>
&gt;&gt; &gt;&gt; &gt; postgres<br>
&gt;&gt; &gt;&gt; &gt;  node_id |  hostname  | port | status | lb_weight |  role   |<br>
&gt;&gt; select_cnt<br>
&gt;&gt; &gt;&gt; |<br>
&gt;&gt; &gt;&gt; &gt; load_balance_node | replication_delay | replication_state |<br>
&gt;&gt; &gt;&gt; &gt;  replication_sync_state | last_status_change<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; ---------+------------+------+--------+-----------+---------+------------+-------------------+-------------------+-------------------+<br>
&gt;&gt; &gt;&gt; &gt; ------------------------+---------------------<br>
&gt;&gt; &gt;&gt; &gt;  0       | 172.16.0.1 | 5432 | up     | 0.500000  | primary | 0<br>
&gt;&gt; &gt;&gt; |<br>
&gt;&gt; &gt;&gt; &gt; true              | 0                 |                   |<br>
&gt;&gt; &gt;&gt; &gt;                         | 2020-04-20 09:23:40<br>
&gt;&gt; &gt;&gt; &gt;  1       | 172.16.0.2 | 5432 | up     | 0.500000  | standby | 0<br>
&gt;&gt; &gt;&gt; |<br>
&gt;&gt; &gt;&gt; &gt; false             | 0                 |                   |<br>
&gt;&gt; &gt;&gt; &gt;                         | 2020-04-20 09:23:40<br>
&gt;&gt; &gt;&gt; &gt; (2 rows)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; [root@server1 ~]#<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Thanks in advance. Regards<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt;<br>
</blockquote></div>