I stopped Postgres on my OSX Mavericks system (using sudo launchctl unload /Library/LaunchDaemons/org.postgresql.postgres.plist
, which appeared to shut down cleanly) and now I can't restart it.
~ $ psql -U postgres
psql: could not connect to server: Connection refused
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
There seem to be no running Postgres processes...
~ $ ps auxwww | grep postgres
anna 78131 0.0 0.0 2432772 648 s004 S+ 12:31pm 0:00.00 grep postgres
But when I try to start it, I get the message 'Operation already in progress'.
~ $ sudo launchctl load /Library/LaunchDaemons/org.postgresql.postgres.plist
/Library/LaunchDaemons/org.postgresql.postgres.plist: Operation already in progress
I've seen other answers suggesting I should delete the postmaster.pid
file, but I can't see any file by this name:
~ $ sudo find / -name postmaster.pid
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
~ $
Does Postgres have a startup log, and if so where could I find it?
You should be able to tell if something is listening to the Postgresql port with
netstat -an | grep -i listen | grep 5432
(if your port is 5432)
Then you can tell what is listening by using:
lsof -i :5432
If nothing is listening on whatever port you set your postgresql instance too listen to, then it isn't running. (for whatever reason) You should double check your postgresql.conf, your pg_hba.conf, and look in pg_log at the log files for errors.
If you are listening on a non-standard port you may need to use the "-p" psql option to set the port. If you are listening on your hostname, but not localhost, you may need to set the "-h" option.
ie:
psql -U postgres -h 10.1.23.4 -p 12345
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With