Postgresql – postgres service suddenly not working after the computer crashed while working

linuxpostgresql

I've been working with postgres on a linux server for the last couple of months. Last week, half of our servers crashed and my one with them. I was in the middle of uploading data to the postgres database with osm2pgsql when this happened. After we revived the server, postgres has stopped working.

commands:

service postgresql start
(Alternatively, /etc/rc.d/init.d/postgresql start, same thing happens)
Starting postgresql service:  [  OK  ]

service postgresql status

postmaster dead but pid file exists

Trying to start the postmaster using

su postgres
postmaster -D /var/lib/pgsql/data

yields nothing either.


As for the pid file, /var/run/postmaster.5432.pid exists, and when I remove it then the status changes to "postmaster is stopped", but if I try to start it again:

service postgresql start
Starting postgresql service: [FAILED]

If anyone has any idea what I could do to get it working, where the problem might be. What really gets me is that it was working until last week, I even rebooted a backup and nothing seems to have changed, I'm really at my wit's end with this problem!

Best Answer

When I faced this message, I checked the postgresstartup.log, it showed that the data directory was having permissions as 777,After I changed to 700 , the postgresql started working

sudo su - postgres

chmod 700 -R <postgresql_Data_Directory>


exit

/etc/init.d/postgresql start

/etc/init.d/postgresql status