Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't restart Postgres on OSX Mavericks - 'Operation already in progress'?

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?

like image 931
Richard Avatar asked Nov 09 '22 17:11

Richard


1 Answers

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
like image 80
rotten Avatar answered Nov 15 '22 04:11

rotten