Re: [GENERAL] cant connect to the database, even after doing start
On Thu, 2006-07-13 at 01:20, surabhi.ahuja wrote: > Hi all, > i have a script to stop and start postmaster > > However i have noticed this many a time sdnow. I stop postmaster using > that script > and then start using a script. > > However if i try to do psql , it gives me an error saying that > the postmaster is not up. > > Why is it that the postmaster went down on its own, even though i had > done a srart after stop. How are you stopping the database? Let me guess that it's "pg_ctl -m immediate stop". pg_ctl --help tells us: Shutdown modes are: smart quit after all clients have disconnected fastquit directly, with proper shutdown immediate quit without complete shutdown; will lead to recovery on restart Basically, -m immediate does a kill -9 on all the postgresql processes. It's an inch away from pulling the plug, except that lying hardware still gets to flush its caches. So, if you're stopping pgsql that way, then when it starts up, it does so in recovery mode, and it can't allow connections until recovery is finished. If you're stopping it some other way though, then things might be going wrong in some other way. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [GENERAL] cant connect to the database, even after doing start
Title: Re: [GENERAL] cant connect to the database, even after doing start this is what is happening stop(){ echo "Stopping ${NAME} service: " if [ "`uname`" = "Linux" ]; then /bin/sh -c "$PGCTL stop -D $PGDATA -s -m fast" > /dev/null 2>&1 fi ret=$? if [ $ret -eq 0 ] then echo_success else echo_failure if [ "`uname`" = "Linux" ]; then /bin/sh -c "$PGCTL stop -D $PGDATA -s -m immediate" > /dev/null 2>&1 fi fi echo} u mean to say that /bin/sh -c "$PGCTL stop -D $PGDATA -s -m immediate" > /dev/null 2>&1is causing problem what shd be done, shd it be removed? From: [EMAIL PROTECTED] on behalf of Scott MarloweSent: Thu 7/13/2006 9:27 PMTo: surabhi.ahujaCc: pgsql generalSubject: Re: [GENERAL] cant connect to the database, even after doing start ***Your mail has been scanned by InterScan VirusWall.***-***On Thu, 2006-07-13 at 01:20, surabhi.ahuja wrote:> Hi all,> i have a script to stop and start postmaster> > However i have noticed this many a time sdnow. I stop postmaster using> that script> and then start using a script.> > However if i try to do psql , it gives me an error saying that> the postmaster is not up.> > Why is it that the postmaster went down on its own, even though i had> done a srart after stop.How are you stopping the database? Let me guess that it's "pg_ctl -mimmediate stop".pg_ctl --help tells us:Shutdown modes are: smart quit after all clients have disconnected fast quit directly, with proper shutdown immediate quit without complete shutdown; will lead to recovery onrestartBasically, -m immediate does a kill -9 on all the postgresql processes.It's an inch away from pulling the plug, except that lying hardwarestill gets to flush its caches.So, if you're stopping pgsql that way, then when it starts up, it doesso in recovery mode, and it can't allow connections until recovery isfinished.If you're stopping it some other way though, then things might be goingwrong in some other way.---(end of broadcast)---TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [GENERAL] cant connect to the database, even after doing start
On Fri, 2006-07-14 at 02:48, surabhi.ahuja wrote: > this is what is happening > > stop(){ > echo "Stopping ${NAME} service: " > if [ "`uname`" = "Linux" ]; then >/bin/sh -c "$PGCTL stop -D $PGDATA -s -m fast" > /dev/null > 2>&1 > fi > ret=$? > if [ $ret -eq 0 ] > then > echo_success > else > echo_failure > if [ "`uname`" = "Linux" ]; then >/bin/sh -c "$PGCTL stop -D $PGDATA -s -m immediate" > > /dev/null 2>&1 > fi > fi > echo > } > > u mean to say that /bin/sh -c "$PGCTL stop -D $PGDATA -s -m > immediate" > /dev/null 2>&1 > is causing problem > > what shd be done, shd it be removed? It's not how I'd do it, certainly. Which branch gets run most the time? Have you tested to make sure that the -m fast really runs and gets a chance to work? What script is this from? Is it a stock one that came with your distribution, or home grown? ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [GENERAL] cant connect to the database, even after doing start
Title: RE: [GENERAL] cant connect to the database, even after doing start this script is taken from the distribution also but i think the second check, to do stop -m immidiate is home grown. thanks, regards Surabhi From: Scott Marlowe [mailto:[EMAIL PROTECTED]Sent: Fri 7/14/2006 9:44 PMTo: surabhi.ahujaCc: pgsql generalSubject: RE: [GENERAL] cant connect to the database, even after doing start ***Your mail has been scanned by InterScan VirusWall.***-***On Fri, 2006-07-14 at 02:48, surabhi.ahuja wrote:> this is what is happening> > stop(){> echo "Stopping ${NAME} service: "> if [ "`uname`" = "Linux" ]; then> /bin/sh -c "$PGCTL stop -D $PGDATA -s -m fast" > /dev/null> 2>&1> fi> ret=$?> if [ $ret -eq 0 ]> then> echo_success> else> echo_failure> if [ "`uname`" = "Linux" ]; then> /bin/sh -c "$PGCTL stop -D $PGDATA -s -m immediate"> > /dev/null 2>&1> fi> fi> echo> }>> u mean to say that /bin/sh -c "$PGCTL stop -D $PGDATA -s -m> immediate" > /dev/null 2>&1> is causing problem> > what shd be done, shd it be removed?It's not how I'd do it, certainly. Which branch gets run most thetime? Have you tested to make sure that the -m fast really runs andgets a chance to work? What script is this from? Is it a stock onethat came with your distribution, or home grown?
[GENERAL] cant connect to the database, even after doing start of postmaster using a script
Hi all, i have a script to stop and start postmaster However i have noticed this many a time sdnow. I stop postmaster using that script and then start using a script. However if i try to do psql , it gives me an error saying that the postmaster is not up. Why is it that the postmaster went down on its own, even though i had done a srart after stop. thanks, regards Surabhi