[pgpool-committers: 5662] Re: pgpool: Set application_name in recovery_conf.

Tatsuo Ishii ishii at sraoss.co.jp
Wed Apr 17 12:50:39 JST 2019


I have added application_name to primary_conninfo in recovery.conf
created by pgpool_setup. Now recovery.conf should look something like:

standby_mode          = 'on'
primary_conninfo      = 'port=11002 user=t-ishii application_name=''server1'''
recovery_target_timeline='latest'
restore_command = 'cp /home/t-ishii/work/Pgpool-II/current/aaa/archivedir/%f "%p" 2> /dev/null'

This should solve the problem in pg_stat_replication when used with
the cluster created by pgpool_setup.

test=# select * from pg_stat_replication;
-[ RECORD 1 ]----+------------------------------
pid              | 12997
usesysid         | 10
usename          | t-ishii
application_name | server1
client_addr      | 
client_hostname  | 
client_port      | -1
backend_start    | 2019-04-17 12:43:00.577782+09
backend_xmin     | 
state            | streaming
sent_lsn         | 0/70000D0
write_lsn        | 0/70000D0
flush_lsn        | 0/70000D0
replay_lsn       | 0/70000D0
write_lag        | 
flush_lag        | 
replay_lag       | 
sync_priority    | 0
sync_state       | async
-[ RECORD 2 ]----+------------------------------
pid              | 13012
usesysid         | 10
usename          | t-ishii
application_name | server2
client_addr      | 
client_hostname  | 
client_port      | -1
backend_start    | 2019-04-17 12:43:00.664987+09
backend_xmin     | 
state            | streaming
sent_lsn         | 0/70000D0
write_lsn        | 0/70000D0
flush_lsn        | 0/70000D0
replay_lsn       | 0/70000D0
write_lag        | 
flush_lag        | 
replay_lag       | 
sync_priority    | 0
sync_state       | async

Since pg_stat_replication does not show anything useful in
client_addr, client_hostname and client_port column for UNIX domain
sockets, the only way to identify each standby servers is using
application_name.

To be honest, I think pg_stat_replication is pretty sloppy here. But
we have to live with it, at least for now.

I also have a plan to add "state" and "sync_state" columns from the
view to show pool_nodes.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

> Set application_name in recovery_conf.
> 
> This allows to show each cluster name as application_name. Currently
> each application_name is set to: server0, server1, server2 and so on,
> where the numeric part is the cluster number. This is especially
> useful to use pg_stat_replication because it does not provide any useful
> information regarding UNIX socket path or port number.
> 
> Branch
> ------
> master
> 
> Details
> -------
> https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=daa530a75b8ad67686ea1710c2733f1939e77dd4
> 
> Modified Files
> --------------
> src/test/pgpool_setup | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
> 


More information about the pgpool-committers mailing list