Search Postgresql Archives

Re: restarting after power outage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is.  We have been fooling with the postmaster startup logic to try to
eliminate this gotcha, but it's only very recently (8.0.2) that I think
we got it right.

So, then it would be correct to change my init scripts to do the
following:  (if so, this patch can be applied to the 7.4 branch)

I would recommend strongly AGAINST that, because what you just did was remove the defense against starting two postmasters concurrently in the same data directory (which would be a disaster of the first magnitude). This is not a problem for bootup of course, but if you ever use this script to start the postmaster by hand, then you are playing with fire.

What I have done is to create a separate init.d script that removes the PID file, and arrange for it to run before the PG startup script. That way you can use the regular script to stop and start without danger, but on a bootup after an unclean shutdown the PID file will get removed before PG gets started. If you're dumb enough to run the removal script by hand while PG is running, you deserve what you get. :)

Or, if your cron supports it, add the following to root's crontab:

@reboot /bin/rm -f /path/to/postgres/pid

Although I like having a separate startup script that runs first to go around removing this and other things as well...

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux