Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id E23C69F965C for ; Sun, 2 Sep 2007 14:45:28 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 96042-03 for ; Sun, 2 Sep 2007 14:45:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id BE2A49F9651 for ; Sun, 2 Sep 2007 14:45:24 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Sun, 02 Sep 2007 12:45:23 -0500 Message-Id: <46DAB05A.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0.2 Date: Sun, 02 Sep 2007 12:45:14 -0500 From: "Kevin Grittner" To: Subject: Managing pid file conflicts for multiple PostgreSQL instances Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/5 X-Sequence-Number: 26766 I ran into an issue with restarting a box after power was cycled with 72 instances of PostgreSQL running. The problem appeared to be that the old pid files, which PostgreSQL never got a chance to clean up, were causing problems when the instances were started or stopped, due to reuse of the pids by instances at different locations. I posted on the hackers list because I thought that there might be a way for PostgreSQL to detect this and prevent the problems. That is not feasible, but people offered three suggestions for how to avoid running into the problem. I'm posting a summary of those solutions here on the admin list, to aid those who may hit the issue and who may not be searching the developer archives for a solution. =20 The original thread is here: =20 http://archives.postgresql.org/pgsql-hackers/2007-08/msg01194.php =20 The three solutions suggested were: =20 (1) Run each instance under a different OS user. =20 (2) Set up a script to clean up old pid files when the OS is booted. =20 (3) Have a script which isn't normally used for managing the instances, but only to clean up the pid files and start the instances after an abrupt failure like a power loss. (For example, we might do something like turn off our existing PostgreSQL instance services under chkconfig and have a "start-all" script to delete pid files and start the services.) =20 Any of the above should keep you out of trouble on a machine with multiple PostgreSQL intances. I do recommend that people in such a situation set themselves up with one of these techniques before they hit a power failure or hardware failure that might expose the issue, since it can be a little confusing in the midst of recovery. (Hmmm... Maybe I'll try to find a good place to put this information in the docs, and submit a doc patch....)= =20 -Kevin =20