Re: Database server restarting - Mailing list pgsql-general
From | shoaib |
---|---|
Subject | Re: Database server restarting |
Date | |
Msg-id | 001c01c3143c$60ffb570$131f020a@vmoksha Whole thread Raw |
In response to | Re: Database server restarting (Tom Lane <tgl@sss.pgh.pa.us>) |
List | pgsql-general |
I am not using any restart script ( may be I understood u wrongly) But I am starting postgres at the time of system boot up and this is the script for that #! /bin/sh # # Startup script to run Postgresql # # start() { if [ `id -u` = 0 ] && ! echo $PATH | /bin/grep -q "/sbin" ; then PATH=/sbin:$PATH fi if [ `id -u` = 0 ] && ! echo $PATH | /bin/grep -q "/usr/sbin" ; then PATH=/usr/sbin:$PATH fi if [ `id -u` = 0 ] && ! echo $PATH | /bin/grep -q "/usr/local/sbin" ; then PATH=/usr/local/sbin:$PATH fi if ! echo $PATH | /bin/grep -q "/usr/X11R6/bin" ; then PATH="$PATH:/usr/X11R6/bin" fi PATH=$PATH:.:/usr/local/jdk/bin:/usr/local/pgsql/bin #FOR NON-RAID #PGDATA=/usr/local/pgsql/data #FOR RAID PGDATA=/data/pgsql/data export PATH PGDATA su -l postgres -s /bin/sh -c "/usr/local/pgsql/bin/pg_ctl start -D $PGDATA -o '-i' -s -l $PGDATA/simspgsql.log &" sleep 1 if [ -f $PGDATA/postmaster.pid ] then echo "PostgreSQL started" else echo "PostgreSQL not started" fi } stop() { su -l postgres -s /bin/sh -c "/usr/local/pgsql/bin/pg_ctl stop -D $PGDATA -s -m fast" sleep 1 if [ -f $PGDATA/postmaster.pid ] then echo "PostgreSQL not stopped" else echo "PostgreSQL is currently stopped" fi } restart() { stop start } status() { su -l postgres -s /bin/sh -c "/usr/local/pgsql/bin/pg_ctl status -D $PGDATA" } case "$1" in start) start ;; stop) stop ;; restart) restart ;; status) status ;; *) echo "Usage: $0 {start|stop|restart|status}" esac Let m know if there is any problem in it. Regards, Shoaib -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us] Sent: Tuesday, May 06, 2003 10:22 PM To: Nigel J. Andrews Cc: shoaib; 'Martijn van Oosterhout'; gearond@cvc.net; pgsql-general@postgresql.org Subject: Re: [GENERAL] Database server restarting "Nigel J. Andrews" <nandrews@investsystems.co.uk> writes: >> But is there any particular reason for database to do such kind of >> behavior. >> DEBUG: pq_recvbuf: unexpected EOF on client connection >> DEBUG: pq_recvbuf: unexpected EOF on client connection >> DEBUG: pq_recvbuf: unexpected EOF on client connection >> DEBUG: pq_recvbuf: unexpected EOF on client connection >> DEBUG: database system was interrupted at 2003-05-03 04:17:19 SGT >> DEBUG: checkpoint record is at 3/85EA18B0 > You've got high system load, inability for processes to claim more memory and > errors about programs exiting at unexpected times. What strikes me about the above trace is that we see "database system was interrupted" without any prior failure. That says to me that something killed the postmaster itself --- if a database child process died, the postmaster would have logged the fact. That leaves me with two questions: what killed the postmaster, and what restarted it? If Nigel's guess is right that the system is under heavy memory pressure, and this is a Linux box, then the kernel itself might have kill -9'd the postmaster to try to get out of a memory shortage. I can't think of very many other theories (though I do recall at least one self-inflicted problem, from someone whose "maintenance script" kill -9'd the postmaster for random reasons...) I'd also like to know whether the system is configured to auto-restart the postmaster, and if so how, and does it do any mucking about (like removing lockfiles) while it's doing so? regards, tom lane
pgsql-general by date: