On Sun, 2 Aug 1998, Patrick Michael Kane wrote:
> Date: Sun, 2 Aug 1998 11:38:39 -0700
> From: Patrick Michael Kane <modus@pr.es.to>
> Reply-To: modperl@apache.org
> To: modperl@apache.org
> Subject: Re: How to rid off persistent database connection ?
>
> On Sun, Aug 02, 1998 at 08:32:22PM +0200, Edmund Mergl wrote:
> > Oleg Bartunov wrote:
> > >
> >
> > >
> > > Currently we have about 150 000 queries (selects only) to postgres in day and
> > > our server ( DUAL PPRO, 256 Mb RAM, SCSI UW) seems works ok.
> > > Will see what happens when I switch to mod_perl enhanced apache with
> > > Apache::DBI authorization.
> > >
> > > But what I'm really worry about is how to gently interrupt alive database
> > > connection, for example to do some administrative job (backup, update ...)
> > >
> > > Regards,
> > >
> > > Oleg
> >
> [snip]
> >
> > For backups there should be no need to interrupt the database
> > connection,
> > at least for read-only access.
> >
> > For updates I would keep the database connections and just redirect
> > any access to a page which tells the user, that the database is
> > currently
> > not accessible.
>
> Edmund's suggestion has the additional benefit of working even if you
> shutdown the database and bring it back up, assuming your DBD has a ping()
> method. Apache::DBI will notice that the database handle is no longer valid
> and bring a new one online, without any intervention on your part.
Just tried to shutdown database (PostgreSQL) by killing postmaster
and keeping established connections (backends) alive. This works fine -
I still can access database using these connections
(through mod_perl cgi, of course, only)
But new connection couldn't established because of absent of postmaster
and I can't restart it because it can't bind port:
mira:~$ runpostgres
FATAL: StreamServerPort: bind() failed: errno=98
Is another postmaster already running on that port?
If not, wait a few seconds and retry.
/usr/local/pgsql/bin/postmaster: cannot create INET stream port
There are no postmaster I already killed him.
I don't know if this postgreSQL problem, though.
After killing all backends I restarted postmaster and noticed in error_log
messages from Apache::DBI
Database handle destroyed without explicit disconnect ....
and this I understand. Is it possible accurately close all connections
using Apache::DBI and then do all admin. jobs (redirect requests to
another page, shutdown database etc..)
Regards,
Oleg
> --
> Patrick Michael Kane
> <modus@pr.es.to>
>
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83