Thread: Postgresql, HA ?, Monitoring.

Postgresql, HA ?, Monitoring.

From
"V. M."
Date:
Dear Hackers,

i'm using 7.1 in a production environment, porformace is very good, you've 
made a vesy good job.

But there are problems, sometimes backend "failed to start":

(mandrake 7.2, mod_perl 1.24, apache 1.3.14, Apache::DBI)
(deadlock_timeout=2000
max_connections=300)

DBI->connect(dbname=mydb) failed: Backend startup failed
at /home/httpd/cgi-bin/e/lib/DBstuff.pm line 27.

Our application is transactional, with a high degree of concurrency.

I've already a silly monitor in perl that connects every minute to postgres 
to see if connection is ok, but sometimes it gives the error above.

I'm asking to all of you the CORRECT sequence of actions to do a monitor 
that restarts postgresql in the most safe possible way.
This for having a solution that gives a better overall uptime.


For example i must do (??):

0. kill apache so that connection will terminate.
1.killall -TERM postmaster
2. wait for secs, or for what (?)
3. if postgres alive (ps -ef | grep postmaster...) than:  killall -9 postmaster
4.restart postmaster
5. see if it'ok
6.restart apache

etc.


thanks in advance for your answers.

vater mazzola, italy.












valter mazzola
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.



Re: Postgresql, HA ?, Monitoring.

From
Tom Lane
Date:
"V. M." <txian@hotmail.com> writes:
> DBI->connect(dbname=mydb) failed: Backend startup failed

Have you looked in the postmaster log to see *why* this is happening?
Some sort of resource-limitation problem is my bet.

> I'm asking to all of you the CORRECT sequence of actions to do a monitor 
> that restarts postgresql in the most safe possible way.
> This for having a solution that gives a better overall uptime.

Restarting the postmaster because a backend start failed is certainly
not the way to improve uptime.
        regards, tom lane