Re: terminate PG connections

From: raghu ram <raghuchennuru(at)gmail(dot)com>
To: isabella(dot)ghiurea(at)nrc-cnrc(dot)gc(dot)ca
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: terminate PG connections
Date: 2009-07-01 01:40:37
Message-ID: d331f2ee0906301840t7a4c0678y78b2c3cdb60d5d54@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, Jun 30, 2009 at 11:53 PM, Isabella Ghiurea <
isabella(dot)ghiurea(at)nrc-cnrc(dot)gc(dot)ca> wrote:

> Hello PG Users,
> I would like to know if there is a "clean" way to terminate running and
> idle connections inside PG db ?
> ( I see : pg_cancel_backend (pid) will send the connections to idle stage
> but not disconnecting from db , if you have > 100 idle connections to db
> and don't want to use the OS " kill " )
>
> Thank you
> Isabella
>
>
> --
> -----------------------------------------------------------
> Isabella A. Ghiurea
> Isabella(dot)Ghiurea(at)nrc-cnrc(dot)gc(dot)ca
> Canadian Astronomy Data Centre |
> http://www1.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/ National Research Council of
> Canada, Herzberg Institute of Astrophysics 5071 West Saanich Road, Victoria
> BC V9E 2E7, Canada
> Phone: 250 363-3446 fax: 250 363-0045
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin

Hi,

To kill the process and session you can do like follows:

(1) Edit " pg_hba.conf " file which is in your data directory and at the
bottom of the file add a line as follows:

host all all <client IP address/32> reject

(2)And reload the database.

pg_ctl –D <your data directory path> reload

(3)After that run the following command:

$ pg_ctl -D <your data directory path> kill TERM <procpid>

Thanks & Regards,
Raghu

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message raghu ram 2009-07-01 02:15:33 Re: Restiring pg_dump text file
Previous Message Emanuel Calvo Franco 2009-06-30 21:18:19 Re: Optimal Flexible Architecture or Optimal Configuration Layout for Postgres