Postgresql – RHEL 6: postmaster dead but pid file exists

postgresql

I am using PostgreSQL 9.2 on RedHat 6

I'm a little confused as to why the following is happening:

  1. When postgres is running, performing "service postgresql92-postgresql status" as root results in "postmaster (pid 1379) is running…" (as expected)

  2. As postgres run "pg_ctl stop -D $PGDATA -m s" to stop postgres

  3. As postgres run "pg_ctl -D $PGDATA start" to start postgres (postgres is now running correctly)

  4. Now as root run "service postgresql92-postgresql status", output is now "postmaster dead but pid file exists"

My confusion is why am I getting the message in step 4 when postgres is running correctly? Am I stopping/starting postgres incorrectly?

Best Answer

service postgresql92-postgresql status checks if the file postmaster.5432.pid instead of postmaster.pid.

I'd recommend to use only pg_ctl as postgres and check with ps aux as root. Or use only service postgresql92-postgresql start/stop/status as root. Mixing the two methods would turn into conflicts.