X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 73311476141 for ; Thu, 8 May 2003 16:58:42 -0400 (EDT) Received: from out002.verizon.net (out002pub.verizon.net [206.46.170.141]) by postgresql.org (Postfix) with ESMTP id 1C016474E4F for ; Thu, 8 May 2003 16:58:38 -0400 (EDT) Received: from RavChaim ([162.84.129.6]) by out002.verizon.net (InterMail vM.5.01.05.33 201-253-122-126-133-20030313) with ESMTP id <20030508205839.KOXS22632.out002.verizon.net@RavChaim> for ; Thu, 8 May 2003 15:58:39 -0500 Content-Type: text/plain; charset="iso-8859-1" From: mlaks Subject: Re: Postgresql goes down need to restart (redhat postgresql service script) lock files removal avoid 2 postmasters Date: Thu, 8 May 2003 16:33:08 -0400 User-Agent: KMail/1.4.1 To: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200305081633.08550.mlaks@bellatlantic.net> X-Authentication-Info: Submitted using SMTP AUTH at out002.verizon.net from [162.84.129.6] at Thu, 8 May 2003 15:58:39 -0500 X-Spam-Status: No, hits=-15.7 required=5.0 tests=BAYES_01,QUOTED_EMAIL_TEXT,RCVD_IN_OSIRUSOFT_COM, USER_AGENT_KMAIL autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/102 X-Sequence-Number: 8664 Bruno, Thanks for your help. i checked - grep in the /etc/rc.d/init.d agrees with what you said - those /var/lock and /var/run files are commonly placed in all of the services! Here's my problem: I had 4 out of 5 machines that got creamed this weekend, and all i needed to go in for was to erase that file /var/lib/pgsql/data/postmaster.pid. the same thing!!! (with only one machine) happened about a month ago. I notice that in his script Lamar does this pid=3D`pidof -s postmaster` if [ $pid ] then echo $"Postmaster already running." else #all systems go -- remove any stale lock files rm -f /tmp/.s.PGSQL.* > /dev/null then he starts up pg_ctl. What I would be doing is simply adding in rm -f /var/lib/pgsql/data/postmaster.pid line. It looks like he isnt worried about getting rid of that tmp/.s.PGSQL.* file as long as he ran pidof first - (is /tmp/.s.PGSQL. also a kind of lock file? i dont know - do you know what system sets it up?) Also - what do you do about those files /tmp/.s.PGSQL.* ? and what do you do about the possibility of supervise starting more than one of the postmasters? I like the idea of supervise starting me up again even without a reboot! and i just want to catch this problem and solve it. Thanks, mitchell > On Thursday 08 May 2003 03:48 pm, you wrote: > On Thu, May 08, 2003 at 14:39:08 -0400, > > mlaks wrote: > > now we would not want to kill the postmaster, of course. But should we > > even be TERM'ing the postmaster? I dont know. What do the Postgresql > > Gurus say? > > I regularly use svc -d to shutdown postmaster and svc -u to restart it. > This works just fine. > > > Moreover, if we agree that we need to imbed pg_ctl or postmaster in a > > script to handle the above things, it should be doable to handle all of > > the assorted other files if they are neccesary to handle . > > You don't have to do that. > > > Also what would be the problem in checking for the existence of a > > postmaster and if none exists then killing the lock files. > > I would be very leary of putting this in a script. postmaster already does > this and trying to be smarter than it might cause you a lot of grief. > > > My main problem is that I have machines that get creamed by power surge= s, > > and then wont restart postgresql on reboot of the system because of the > > damn lock files. I really want to deal with them up front! > > Most of the time when I have unscheduled shutdowns postgres comes up > without problem. I don't remember if I have had any since I switched to > using supervise though. I have had more issues with someone needing to > answer a question from fsck from the console than postgresql not coming u= p. > > > MOreover can you tell me more about what init uses the locks for? > > To tell if the service is already running or not. > > > what is the role of the files > > > > /var/run/postmaster.pid > > /var/lock/subsys/postgresql > > > > that Lamar carefully adds and subtracts? > > I don't know exactly, but I would expect that the pid file is a lock for > the service and that the subsys file is a lock to keep two init scripts > from running for the same time for the same service. > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org -------------------------------------------------------