pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
close connection
4+ messages / 3 participants
[nested] [flat]

* close connection
@ 2003-11-07 04:52 Freddy Expósito Moreno <fredo@uh.cu>
  2003-11-07 08:38 ` Re: close connection Oli Sennhauser <oli.sennhauser@bluewin.ch>
  0 siblings, 1 reply; 4+ messages in thread

From: Freddy Expósito Moreno @ 2003-11-07 04:52 UTC (permalink / raw)
  To: pgsql-admin

I need to close all connections from one database and keep all 
connection from the other databases in my postgresql server.

Can some body help me?




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: close connection
  2003-11-07 04:52 close connection Freddy Expósito Moreno <fredo@uh.cu>
@ 2003-11-07 08:38 ` Oli Sennhauser <oli.sennhauser@bluewin.ch>
  2003-11-07 13:17   ` Re: close connection Freddy Expósito Moreno <fredo@uh.cu>
  0 siblings, 1 reply; 4+ messages in thread

From: Oli Sennhauser @ 2003-11-07 08:38 UTC (permalink / raw)
  To: Freddy Expósito Moreno <fredo@uh.cu>; pgsql-admin

Freddy Expósito Moreno wrote:

> I need to close all connections from one database and keep all 
> connection from the other databases in my postgresql server.
>
> Can some body help me?

Hello Freddy

This could be a solution, but probably not a good/the best one:

1.) Mark out the database in pg_hba.conf, e.g.

# TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK           METHOD
local   T740A       all                                             reject
local   all         all                                             trust

2.) Reload the cluster

pg_ctl reload -D $PG_DATA

or

pg_reload CLUSTER1   # with pg_env

Now no more new connections are possible

3.) Kill all processes which are related to your db

postgres@master:/u00/app/pgsql - rdbms740/template0> ps -fu postgres | 
grep T740A
postgres 28375 27864  1 09:16 pts/1    00:00:00 postgres: postgres T740A 
[local] idle

ps -fu postgres | grep T740A | grep -v grep | cut -d" " -f2 | \
while read pid ; do
  kill ${pid} 2>/dev/null
done

Regards Oli

-------------------------------------------------------

Oli Sennhauser
Database-Engineer (Oracle & PostgreSQL)
Rebenweg 6
CH - 8610 Uster / Switzerland

Phone (+41) 1 940 24 82 or Mobile (+41) 79 450 49 14
e-Mail oli.sennhauser@bluewin.ch
Website http://mypage.bluewin.ch/shinguz/PostgreSQL/

Secure (signed/encrypted) e-Mail with a Free Personal SwissSign ID: http://www.swisssign.ch

Import the SwissSign Root Certificate: http://swisssign.net/cgi-bin/trust/import

Attachments:

  smime.p7s (application/x-pkcs7-signature, 3.4K) download

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: close connection
  2003-11-07 04:52 close connection Freddy Expósito Moreno <fredo@uh.cu>
  2003-11-07 08:38 ` Re: close connection Oli Sennhauser <oli.sennhauser@bluewin.ch>
@ 2003-11-07 13:17   ` Freddy Expósito Moreno <fredo@uh.cu>
  2003-11-07 15:55     ` Re: close connection Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Freddy Expósito Moreno @ 2003-11-07 13:17 UTC (permalink / raw)
  To: Oli Sennhauser <oli.sennhauser@bluewin.ch>; +Cc: pgsql-admin

This is a good idea if I want to reject the access to this  database 
every time but in my case I need to close de access to one database
one time and could be any database in any moment. A need a dynamic solution.

Thanks any way  Oli


Oli Sennhauser wrote:

> Freddy Expósito Moreno wrote:
>
>> I need to close all connections from one database and keep all 
>> connection from the other databases in my postgresql server.
>>
>> Can some body help me?
>
>
> Hello Freddy
>
> This could be a solution, but probably not a good/the best one:
>
> 1.) Mark out the database in pg_hba.conf, e.g.
>
> # TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK           
> METHOD
> local   T740A       all                                             
> reject
> local   all         all                                             trust
>
> 2.) Reload the cluster
>
> pg_ctl reload -D $PG_DATA
>
> or
>
> pg_reload CLUSTER1   # with pg_env
>
> Now no more new connections are possible
>
> 3.) Kill all processes which are related to your db
>
> postgres@master:/u00/app/pgsql - rdbms740/template0> ps -fu postgres | 
> grep T740A
> postgres 28375 27864  1 09:16 pts/1    00:00:00 postgres: postgres 
> T740A [local] idle
>
> ps -fu postgres | grep T740A | grep -v grep | cut -d" " -f2 | \
> while read pid ; do
>  kill ${pid} 2>/dev/null
> done
>
> Regards Oli
>
> -------------------------------------------------------
>
> Oli Sennhauser
> Database-Engineer (Oracle & PostgreSQL)
> Rebenweg 6
> CH - 8610 Uster / Switzerland
>
> Phone (+41) 1 940 24 82 or Mobile (+41) 79 450 49 14
> e-Mail oli.sennhauser@bluewin.ch
> Website http://mypage.bluewin.ch/shinguz/PostgreSQL/
>
> Secure (signed/encrypted) e-Mail with a Free Personal SwissSign ID: 
> http://www.swisssign.ch
>
> Import the SwissSign Root Certificate: 
> http://swisssign.net/cgi-bin/trust/import
>





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: close connection
  2003-11-07 04:52 close connection Freddy Expósito Moreno <fredo@uh.cu>
  2003-11-07 08:38 ` Re: close connection Oli Sennhauser <oli.sennhauser@bluewin.ch>
  2003-11-07 13:17   ` Re: close connection Freddy Expósito Moreno <fredo@uh.cu>
@ 2003-11-07 15:55     ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2003-11-07 15:55 UTC (permalink / raw)
  To: Freddy Expósito Moreno <fredo@uh.cu>; +Cc: Oli Sennhauser <oli.sennhauser@bluewin.ch>; pgsql-admin

=?ISO-8859-1?Q?Freddy_Exp=F3sito_Moreno?= <fredo@uh.cu> writes:
> This is a good idea if I want to reject the access to this  database 
> every time but in my case I need to close de access to one database
> one time and could be any database in any moment. A need a dynamic solution.

If you are really insistent on doing that, you'll need to set up a
separate installation (separate postmaster) for each database.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2003-11-07 15:55 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-07 04:52 close connection Freddy Expósito Moreno <fredo@uh.cu>
2003-11-07 08:38 ` Oli Sennhauser <oli.sennhauser@bluewin.ch>
2003-11-07 13:17   ` Freddy Expósito Moreno <fredo@uh.cu>
2003-11-07 15:55     ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox