Thread: Re: [GENERAL] Again: How the hell do I restart immediately

Re: [GENERAL] Again: How the hell do I restart immediately

From
Mike Mascari
Date:
--- Michael Simms <grim@argh.demon.co.uk> wrote:
> >
> > I posted this question before and got no good
> responses. I'm posting it
> > again out of pure desperation.
> >
> > I've got a Postgres 6.5.1 server running on a
> RedHat (i386) 5.2 box.
> > PostgreSQL was compiled from source with no
> special configuration options.
> >
> > The server is dying about once or twice a week.
> This is making me look like
> > crap to the rest of the company since our
> e-commerce solution is built up
> > around PostgreSQL and we can't take orders when
> the sevrer is down.
> >
> > What can I do to ensure (a) the server doesn't go
> down or (b) if the server
> > does down, it gets restarted immediately?!
> >
> > Please respond if you have any good ideas.
>
> Well, I have a hack of a little shell script that
> will restart it
> within 60 seconds. Its not efficient, pleasant or
> anything else, but
> it does the job

...[snip]...

According to the INSTALL document which came with
the distribution (possibly the following remark has
been removed in recent versions?), for RedHat Linux:

----------------------------------------------------
In RedHat Linux edit file /etc/inittab to add the
following as a single line:

pg:2345:respawn:/bin/su - postgres -c
  "/usr/local/pgsql/bin/postmaster
   -D/usr/local/pgsql/data >>
   /usr/local/pgsql/server.log 2>&1 </dev/null"
----------------------------------------------------

When the postmaster dies, init will automatically
respawn it, much the same as getty, or xdm, etc.
Now, since init will be starting the postmaster,
the /etc/rc.d/init.d script should be removed and
the links to it in /etc/rc.d/rc[whatever].d should
also be removed (or you could just not run this
service using linuxconf using the control service
activity option). And, of course, the switches in
the inittab entry above should be adjusted accordingly
to the appropriate site's settings.

That should ease the symptom but the problem still
remains. We run an e-commerce type web-based
application backed by PostgreSQL 6.5 around the clock.
I haven't seen a postmaster die since 6.4.0. Is there
any indication as to what is causing the postmaster to
die?

Hope the above helps,
Mike Mascari
(mascarim@yahoo.com)








=====

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com

Re: [GENERAL] Again: How the hell do I restart immediately

From
"Doran L. Barton"
Date:
Not long ago, Mike Mascari proclaimed...
> According to the INSTALL document which came with
> the distribution (possibly the following remark has
> been removed in recent versions?), for RedHat Linux:
>
> ----------------------------------------------------
> In RedHat Linux edit file /etc/inittab to add the
> following as a single line:
>
> pg:2345:respawn:/bin/su - postgres -c
>   "/usr/local/pgsql/bin/postmaster
>    -D/usr/local/pgsql/data >>
>    /usr/local/pgsql/server.log 2>&1 </dev/null"
> ----------------------------------------------------
>
> When the postmaster dies, init will automatically
> respawn it, much the same as getty, or xdm, etc.
> Now, since init will be starting the postmaster,
> the /etc/rc.d/init.d script should be removed and
> the links to it in /etc/rc.d/rc[whatever].d should
> also be removed (or you could just not run this
> service using linuxconf using the control service
> activity option). And, of course, the switches in
> the inittab entry above should be adjusted accordingly
> to the appropriate site's settings.

I tried this initially and init (RedHat 5.2) complained that the command
string was too long. *sighs*

> That should ease the symptom but the problem still
> remains. We run an e-commerce type web-based
> application backed by PostgreSQL 6.5 around the clock.
> I haven't seen a postmaster die since 6.4.0. Is there
> any indication as to what is causing the postmaster to
> die?

I agree. I've been running PostgreSQL since Postgres95 and I've never had
these kinds of problems... but regardless. They're happening.

The log file offer one piece of evidence (which I don't understand):

  Oct  7 21:22:13 lists logger: ERROR:  postmaster: StreamConnection:
  accept: No route to host

And then... it dies. I see this message in the log every time the server
has died. It was doing this under 6.4.2 and now again with 6.5.1.

Again, any helpful pointers would be MUCH appreciated.

--
Doran L. Barton <fozz@iodynamics.com>
Iodynamics LLC -- "Internetworking the masses"
<URL:http://www.iodynamics.com/>

Re: [GENERAL] Again: How the hell do I restart immediately

From
"Gene Selkov, Jr."
Date:
> > When the postmaster dies, init will automatically
> > respawn it, much the same as getty, or xdm, etc.
> > Now, since init will be starting the postmaster,
> > the /etc/rc.d/init.d script should be removed and
> > the links to it in /etc/rc.d/rc[whatever].d should
> > also be removed (or you could just not run this
> > service using linuxconf using the control service
> > activity option). And, of course, the switches in
> > the inittab entry above should be adjusted accordingly
> > to the appropriate site's settings.
>
> I tried this initially and init (RedHat 5.2) complained that the command
> string was too long. *sighs*

The first time I was taught indirect addressing was in my elementary
school computer class. Back then, computers were programmed by
plugging metal instruction keys into the wholes on the switchboard. It
is much easier now :)

My inittab entry has the following line:

pg:2345:respawn:/usr/local/pgsql/start.sh

while /usr/local/pgsql/start.sh has the following permissions:

-rwxr-xr-x   1 postgres users         154 Jun 18 19:20 /usr/local/pgsql/start.sh

and reads as:

#!/bin/sh
exec /bin/su - postgres -c "/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data -i -B 4096 >>
/usr/local/pgsql/server.log2>&1" /dev/null  

You can add

rm -f /tmp/.s.PGSQL.5432

if you are warried about false starts.


--Gene