Re: Preventing access temporarily.

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Preventing access temporarily.
Date: 2012-01-26 22:55:29
Message-ID: 0AD01C53605506449BA127FB8B99E5E1037FFC@FMSMSX105.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I found something else on the web.

update pg_database set datallowconn = false where datname = 'foo';
update pg_database set datallowconn = true where datname = 'foo';

Seems to have worked OK.

Thanks for the pg_hab.conf suggestion. I'll add that to my notes.

-----Original Message-----
From: Scott Marlowe [mailto:scott(dot)marlowe(at)gmail(dot)com]
Sent: Thursday, January 26, 2012 5:39 PM
To: Gauthier, Dave
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Preventing access temporarily.

On Thu, Jan 26, 2012 at 3:05 PM, Gauthier, Dave <dave(dot)gauthier(at)intel(dot)com> wrote:
> PG V9.0.1 on Linux
>
>
>
> I want to temporarily prevent users from connecting to a DB, let the
> existing connections finish, <do some work>, re-enable connections.
>
> What's the best way to do that?

Edit pg_hba.conf to reject all connections and reload. current
connections will stay connected, new ones will be refused. use
pg_stat_activity to monitor connections til they're all gone / idle.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2012-01-26 22:58:02 Re: Preventing access temporarily.
Previous Message Scott Marlowe 2012-01-26 22:39:28 Re: Preventing access temporarily.