We have a rails 4 application with postgres
Sometimes our server hanged and if we reboot it .
The server gets started but it can not connect to postgres.
status shows postmaster dead but pid file exists
log shows
FATAL: lock file "/tmp/.s.PGSQL.5432.lock" already exists HINT: Is another postmaster (PID 4696) using socket file "/tmp/.s.PGSQL.5432"? LOG: could not bind IPv4 socket: Address already in use
and the postgresql could not restarted.
--- After deleting the /tmp/.s.PGSQL.5432 file and restarting the postgres service the service restarted but the postgres can not connect with host we added.
What can we do to fix this issue ?
Thanks in advance