2009-05-04

PostgreSQL - pg_ctl: invalid data in PID file

One fine day, when restarting PostgreSQL :


/usr/local/etc/rc.d/postgresql restart
it complained that
pg_ctl: invalid data in PID file "/postgres/directory/postmaster.pid"

postmaster.pid was the process ID file for PostgreSQL, which indicate PostgreSQL process. If the file exists, it would mean that PostgreSQL is alive and running. If it doesn't, it would (of cause) mean PostgreSQL have been terminated, either on purpose or abnormally.

In this case, the file exist but the PostgreSQL instance is not running. After looking at the file, it was empty, no indication of process ID or whatsoever digit to describe the process. This lead to the conclusion of have been terminated abnormally, leaving an empty postmaster.pid.

The solution to this scenario would be manually removing the postmaster.pid file at /postgres/directory/postmaster.pid and start it again, then it should be fine.

Voilla !!!

1 comment:

Оги said...

Thanks man for this solution you saved me!