Search Postgresql Archives

Restart after poweroutage

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

 



I recently had another electrical power outage that left my machine unable to restart postgresql. I had previously reported this a while ago:

http://archives.postgresql.org/pgsql-general/2005-04/msg01286.php

Anyway, because I have seen this problem before, I knew exactly what the solution to the problem was (delete the postmaster.pid file), but for yucks I decided to imagine I did not know. What would I need to do to figure this out.

[root@bilbo ~]# cat /etc/issue
Fedora Core release 5 (Bordeaux)
[root@bilbo ~]# rpm -q postgresql
postgresql-8.1.4-1.FC5.1

Looking in /etc/init.d/postgresql I found that this file exists:
/var/lib/pgsql/pgstartup.log

[root@bilbo ~]# grep PGLOG /etc/init.d/postgresql
PGLOG=/var/lib/pgsql/pgstartup.log

Looking at $PGLOG, I discovered:
FATAL: pre-existing shared memory block (key 5432001, ID 65536) is still in use HINT: If you're sure there are no old server processes still running, remove the shared memory block with the command "ipcclean", "ipcrm", or just delete the file "postmaster.pid".

From this commentary, to find "postmaster.pid" I ran:
[root@bilbo ~]# find /var | grep postmaster.pid
/var/lib/pgsql/data/postmaster.pid

[root@bilbo ~]# rm /var/lib/pgsql/data/postmaster.pid
[root@bilbo ~]# service postgresql start
Starting postgresql service:                               [  OK  ]

I am a long time pgsql user, and it still took me a while (and some hunting) to find the solution to this problem. This may be a real stumbling block of a new user. According to commentary on my report from April 2005, Tom mentions that there was an automated solution to this issue in v8.0.2:

http://archives.postgresql.org/pgsql-general/2005-04/msg01289.php

I can reproduce this problem in v8.1.4 by these simple steps:

[root@bilbo ~]# service postgresql start
Starting postgresql service:                               [  OK  ]
[root@bilbo ~]# service postgresql stop
Stopping postgresql service:                               [  OK  ]
[root@bilbo ~]# touch /var/lib/pgsql/data/postmaster.pid
[root@bilbo ~]# service postgresql start
Starting postgresql service:                               [FAILED]
[root@bilbo ~]# rm /var/lib/pgsql/data/postmaster.pid
[root@bilbo ~]# service postgresql start
Starting postgresql service:                               [  OK  ]

PS: This email is just a FYI, not a complaint. Maybe it is just a right of passage that users of postgresql will just have to learn about this.

--
-**-*-*---*-*---*-*---*-----*-*-----*---*-*---*-----*-----*-*-----*---
 Jon Lapham  <lapham@xxxxxxxxx>                Rio de Janeiro, Brasil
 Personal: http://www.jandr.org/
***-*--*----*-------*------------*--------------------*---------------



[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