[pgpool-general: 6663] Re: get active number of connection

Takuma Hoshiai hoshiai at sraoss.co.jp
Thu Aug 1 16:59:08 JST 2019


On Thu, 1 Aug 2019 12:32:54 +0530
temp temp <ttemp666 at gmail.com> wrote:

> Hi Takuma,
> 
> While connecting to pgpool , I am setting the application name also, so at
> a time I want to know which pgpool child process connected to which client
> application .
> pcp_proc_info is not giving this information.

I think, we have two way which you can check application name, it takes time.

The first, you use '%a' paramter of log_line_prefix, and log_connections set
on. you need to match the result of pcp_proc_info and application_name in pgpool.log.

The second, you get result of pg_stat_activity while you execute pcp_proc_info
command. application name and backend PID are contained by pg_stat_activity, 
so you can match result pcp_proc_info.

> On Thu, Aug 1, 2019, 12:27 Takuma Hoshiai <hoshiai at sraoss.co.jp> wrote:
> 
> > Hi,
> >
> > On Wed, 31 Jul 2019 22:31:57 +0530
> > temp temp <ttemp666 at gmail.com> wrote:
> >
> > > Hi,
> > >
> > > Is there any way to check  the number of active session between client
> > and
> > > pgpool, meaning at a particular time which client connected to which
> > pgpool
> > > child process(pid)
> >
> > you can use pcp_proc_info command.
> > If 9th value of command output equals '1' , its session is connecting now
> > from client.
> > pgpool child process is specified by 10th value.
> >
> > For example:
> > $ pcp_proc_info -p 11001 -h localhost -w
> > test test_user 2019-08-01 15:18:53 2019-08-01 15:46:43 3 0 2 13750 0 11968
> > 0
> > test test_user 2019-08-01 15:18:53 2019-08-01 15:46:43 3 0 2 13751 0 11968
> > 1
> > test test_user 2019-08-01 15:46:21 2019-08-01 15:46:43 3 0 4 13744 1 13694
> > 0
> > test test_user 2019-08-01 15:46:21 2019-08-01 15:46:43 3 0 4 13745 1 13694
> > 1
> > test test_user 2019-08-01 15:08:54 2019-08-01 15:48:37 3 0 1 14024 1 11128
> > 0
> > test test_user 2019-08-01 15:08:54 2019-08-01 15:48:37 3 0 1 14023 1 11128
> > 1
> > test test_user 2019-08-01 15:08:54 2019-08-01 15:46:43 3 0 2 13747 0 11129
> > 0
> > test test_user 2019-08-01 15:08:54 2019-08-01 15:46:43 3 0 2 13746 0 11129
> > 1
> > test test_user 2019-08-01 15:08:54 2019-08-01 15:48:37 3 0 1 14022 1 11132
> > 0
> > test test_user 2019-08-01 15:08:54 2019-08-01 15:48:37 3 0 1 14021 1 11132
> > 1
> > test test_user 2019-08-01 15:08:54 2019-08-01 15:46:43 3 0 5 13748 1 11134
> > 0
> > test test_user 2019-08-01 15:08:54 2019-08-01 15:46:43 3 0 5 13749 1 11134
> > 1
> > test test_user 2019-08-01 15:08:54 2019-08-01 15:48:37 3 0 1 14025 1 11135
> > 0
> > test test_user 2019-08-01 15:08:54 2019-08-01 15:48:37 3 0 1 14026 1 11135
> > 1
> > test test_user 2019-08-01 15:46:21 2019-08-01 15:46:43 3 0 2 13752 0 13690
> > 0
> > test test_user 2019-08-01 15:46:21 2019-08-01 15:46:43 3 0 2 13753 0 13690
> > 1
> >
> > Show a pgpool process pid that it is connected to client:
> >
> > $ pcp_proc_info -p 11001 -h localhost -w |awk '!colname[$12]++{if($11 ==
> > 1) {print  $12}}'
> > 13694
> > 11128
> > 11132
> > 11134
> > 11135
> >
> >
> > >
> > > Thanks
> >
> > Best Regards,
> >
> > --
> > Takuma Hoshiai <hoshiai at sraoss.co.jp>
> >
> >

Best Regards,

-- 
Takuma Hoshiai <hoshiai at sraoss.co.jp>



More information about the pgpool-general mailing list