pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedTaking database offline
12+ messages / 5 participants
[nested] [flat]
* Taking database offline
@ 2003-11-12 20:07 ow <oneway_111@yahoo.com>
0 siblings, 2 replies; 12+ messages in thread
From: ow @ 2003-11-12 20:07 UTC (permalink / raw)
To: pgsql-admin
Hi,
Is there a way to take the database offline to keep users out?
Is there a way to take the database offline but still allowing pg_restore to
run against it?
Thanks
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Taking database offline
@ 2003-11-12 21:08 scott.marlowe <scott.marlowe@ihs.com>
parent: ow <oneway_111@yahoo.com>
1 sibling, 1 reply; 12+ messages in thread
From: scott.marlowe @ 2003-11-12 21:08 UTC (permalink / raw)
To: ow <oneway_111@yahoo.com>; +Cc: pgsql-admin
On Wed, 12 Nov 2003, ow wrote:
> Hi,
>
> Is there a way to take the database offline to keep users out?
> Is there a way to take the database offline but still allowing pg_restore to
> run against it?
Yes, as of 7.3 you can create entries in pg_hba.conf that control who can
connect to what database. Just make a backup of the original pg_hba.conf,
and set up your copy to have only the postgres (or other) superuser be
allowed to connect. Then, swap the two hba files and restart the server.
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Taking database offline
@ 2003-11-12 21:09 Bruno Wolff III <bruno@wolff.to>
parent: ow <oneway_111@yahoo.com>
1 sibling, 0 replies; 12+ messages in thread
From: Bruno Wolff III @ 2003-11-12 21:09 UTC (permalink / raw)
To: ow <oneway_111@yahoo.com>; +Cc: pgsql-admin
On Wed, Nov 12, 2003 at 12:07:23 -0800,
ow <oneway_111@yahoo.com> wrote:
> Hi,
>
> Is there a way to take the database offline to keep users out?
> Is there a way to take the database offline but still allowing pg_restore to
> run against it?
You could shut the database down, change pg_hba.conf to only let in
the postgres user, bring the system back up. Once you finish your restore
you can repeat the procedure, this time change pg_hba.conf to let everyone
back in.
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Taking database offline
@ 2003-11-13 05:10 Bruce Momjian <pgman@candle.pha.pa.us>
parent: scott.marlowe <scott.marlowe@ihs.com>
0 siblings, 1 reply; 12+ messages in thread
From: Bruce Momjian @ 2003-11-13 05:10 UTC (permalink / raw)
To: scott.marlowe <scott.marlowe@ihs.com>; +Cc: ow <oneway_111@yahoo.com>; pgsql-admin
scott.marlowe wrote:
> On Wed, 12 Nov 2003, ow wrote:
>
> > Hi,
> >
> > Is there a way to take the database offline to keep users out?
> > Is there a way to take the database offline but still allowing pg_restore to
> > run against it?
>
> Yes, as of 7.3 you can create entries in pg_hba.conf that control who can
> connect to what database. Just make a backup of the original pg_hba.conf,
> and set up your copy to have only the postgres (or other) superuser be
> allowed to connect. Then, swap the two hba files and restart the server.
Rather than restart the server (kicking everyone out), does 'reload'
help to keep new users out and let the old ones leave on their own?
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Taking database offline
@ 2003-11-13 07:05 ow <oneway_111@yahoo.com>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 2 replies; 12+ messages in thread
From: ow @ 2003-11-13 07:05 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; scott.marlowe <scott.marlowe@ihs.com>; +Cc: ow <oneway_111@yahoo.com>; pgsql-admin
--- Bruce Momjian <pgman@candle.pha.pa.us> wrote:
>
> Rather than restart the server (kicking everyone out), does 'reload'
> help to keep new users out and let the old ones leave on their own?
>
Not really ... users (old or new) should not work with the db unless it's
completely loaded. Restarting the server will affect activity in other dbs in
that cluster which is not desirable :( IMHO, there should be a way to do this
without restarting the server.
Thanks
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Taking database offline
@ 2003-11-13 08:12 Oli Sennhauser <oli.sennhauser@bluewin.ch>
parent: ow <oneway_111@yahoo.com>
1 sibling, 1 reply; 12+ messages in thread
From: Oli Sennhauser @ 2003-11-13 08:12 UTC (permalink / raw)
To: ow <oneway_111@yahoo.com>; pgsql-admin
Hello
>Not really ... users (old or new) should not work with the db unless it's
>completely loaded. Restarting the server will affect activity in other dbs in
>that cluster which is not desirable :( IMHO, there should be a way to do this
>without restarting the server.
>
>
What about having two database clusters on a server for separating HA
from "not so HA" databases? You can take down one db cluster. And people
can still work on the other one (DB Cluster does nothing has to do with
hardware or os cluster).
I know it is not so simple. I worked out a concept for this and need
some alpha-Testers?
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] 12+ messages in thread
* Re: Taking database offline
@ 2003-11-13 14:39 ow <oneway_111@yahoo.com>
parent: Oli Sennhauser <oli.sennhauser@bluewin.ch>
0 siblings, 0 replies; 12+ messages in thread
From: ow @ 2003-11-13 14:39 UTC (permalink / raw)
To: Oli Sennhauser <oli.sennhauser@bluewin.ch>; pgsql-admin
--- Oli Sennhauser <oli.sennhauser@bluewin.ch> wrote:
> What about having two database clusters on a server for separating HA
> from "not so HA" databases? You can take down one db cluster. And people
> can still work on the other one (DB Cluster does nothing has to do with
> hardware or os cluster).
There's got to be a simpler solution than this. What about the file space? E.g.
a large db with 000s of GBs. How would one even keep those db clusters in sync?
Maybe I'm missing something ...
Thanks
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Taking database offline
@ 2003-11-13 14:54 Bruce Momjian <pgman@candle.pha.pa.us>
parent: ow <oneway_111@yahoo.com>
1 sibling, 1 reply; 12+ messages in thread
From: Bruce Momjian @ 2003-11-13 14:54 UTC (permalink / raw)
To: ow <oneway_111@yahoo.com>; +Cc: scott.marlowe <scott.marlowe@ihs.com>; pgsql-admin
ow wrote:
>
> --- Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> >
> > Rather than restart the server (kicking everyone out), does 'reload'
> > help to keep new users out and let the old ones leave on their own?
> >
>
> Not really ... users (old or new) should not work with the db unless it's
> completely loaded. Restarting the server will affect activity in other dbs in
> that cluster which is not desirable :( IMHO, there should be a way to do this
> without restarting the server.
You can restrict pg_hba.conf to not allow connections just to one
database if you want.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Taking database offline
@ 2003-11-13 15:22 ow <oneway_111@yahoo.com>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 12+ messages in thread
From: ow @ 2003-11-13 15:22 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: scott.marlowe <scott.marlowe@ihs.com>; pgsql-admin
--- Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> You can restrict pg_hba.conf to not allow connections just to one
> database if you want.
>
True, but that still would not prevent users who are already connected from
accessing the db, would it?
Thanks
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Taking database offline
@ 2003-11-13 15:32 Bruce Momjian <pgman@candle.pha.pa.us>
parent: ow <oneway_111@yahoo.com>
0 siblings, 1 reply; 12+ messages in thread
From: Bruce Momjian @ 2003-11-13 15:32 UTC (permalink / raw)
To: ow <oneway_111@yahoo.com>; +Cc: scott.marlowe <scott.marlowe@ihs.com>; pgsql-admin
ow wrote:
>
> --- Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> > You can restrict pg_hba.conf to not allow connections just to one
> > database if you want.
> >
>
> True, but that still would not prevent users who are already connected from
> accessing the db, would it?
No, I guess that is the problem. You can use restart, which will kick
everyone out, or you can use reload, but that doesn't kick people out of
the single database you want.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Taking database offline
@ 2003-11-13 15:50 ow <oneway_111@yahoo.com>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 12+ messages in thread
From: ow @ 2003-11-13 15:50 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: scott.marlowe <scott.marlowe@ihs.com>; pgsql-admin
--- Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> No, I guess that is the problem. You can use restart, which will kick
> everyone out, or you can use reload, but that doesn't kick people out of
> the single database you want.
>
Restarting the db server triggers the whole chain of events: other dbs are
affected, app servers will also need to restarted, and that has to be done
twice (change pg_hba.conf and then reverse). There's got to be a better way.
Thanks
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Taking database offline
@ 2003-11-13 16:20 Bruce Momjian <pgman@candle.pha.pa.us>
parent: ow <oneway_111@yahoo.com>
0 siblings, 0 replies; 12+ messages in thread
From: Bruce Momjian @ 2003-11-13 16:20 UTC (permalink / raw)
To: ow <oneway_111@yahoo.com>; +Cc: scott.marlowe <scott.marlowe@ihs.com>; pgsql-admin
ow wrote:
>
> --- Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> > No, I guess that is the problem. You can use restart, which will kick
> > everyone out, or you can use reload, but that doesn't kick people out of
> > the single database you want.
> >
>
> Restarting the db server triggers the whole chain of events: other dbs are
> affected, app servers will also need to restarted, and that has to be done
> twice (change pg_hba.conf and then reverse). There's got to be a better way.
OK, use reload, then use 'ps' to see the people connected to the
database and send a signal to the backend to for it to exit --- this is
how the postmaster does it.
Signals to use from the 7.4 postgres manual:
<para>
The <command>postmaster</command> uses <literal>SIGTERM</literal>
to tell a <command>postgres</command> process to quit normally and
<literal>SIGQUIT</literal> to terminate without the normal cleanup.
These signals <emphasis>should not</emphasis> be used by users. It is also
unwise to send <literal>SIGKILL</literal> to a <command>postgres</command>
process --- the <command>postmaster</command> will interpret this as
a crash in <command>postgres</command>, and will force all the sibling
<command>postgres</command> processes to quit as part of its standard
crash-recovery procedure.
</para>
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 12+ messages in thread
end of thread, other threads:[~2003-11-13 16:20 UTC | newest]
Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-12 20:07 Taking database offline ow <oneway_111@yahoo.com>
2003-11-12 21:08 ` scott.marlowe <scott.marlowe@ihs.com>
2003-11-13 05:10 ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-11-13 07:05 ` ow <oneway_111@yahoo.com>
2003-11-13 08:12 ` Oli Sennhauser <oli.sennhauser@bluewin.ch>
2003-11-13 14:39 ` ow <oneway_111@yahoo.com>
2003-11-13 14:54 ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-11-13 15:22 ` ow <oneway_111@yahoo.com>
2003-11-13 15:32 ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-11-13 15:50 ` ow <oneway_111@yahoo.com>
2003-11-13 16:20 ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-11-12 21:09 ` Bruno Wolff III <bruno@wolff.to>
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