Friday, October 23, 2015

macos - Mac updated just now, postgres now broken

I run postgres 9.1 / ruby 1.9.2 / rails 3.1.0 on a maxbook air for local dev. It's all been running smoothly for months, (though this is the first time I've done development on a mac.)



It's a macbook air from last year, and today I got the mac osx software update message as I have a few times before, and my system downloaded approx 450mb of updates and restarted. It now says it's on OSX 10.7.3.



Point is, postgres has stopped working, when I start my thin server (mirror heroku cedar) as normal, and then browse to my rails app I get:



PG::Error


could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?


What happened? After browsing around a few questions I'm still confused, but here's some extra info:




  • Running psql from command line gives same error


  • I can run pgadmin 3 and connect via it and run SQL no problems

  • Running which psql shows the version as /usr/bin/psql

  • I created a PostgreSQL user back when I got the mac (it's always been on lion) I've no idea why, almost certainly I was following a tutorial which I neglected to store in my notes. Point is I am aware there is a _postgres user as well. I know it's rubbish, but apart from a note on passwords, I don't have any extra info on how I configured postgres - though the obvious implication is that I did not use the _postgres user.



Anyone have suggestions or information on what might have changed / what I can try to debug and fix? Thanks.



Edit: Playing around based on this question and answer: https://stackoverflow.com/questions/7975414/check-status-of-postgresql-server-mac-os-x, see this string of commands:



$ sudo su postgreSQL

bash-3.2$ /Library/PostgreSQL/9.1/bin/pg_ctl start -D /Library/PostgreSQL/9.1/data
pg_ctl: another server might be running; trying to start server anyway
server starting
bash-3.2$ 2012-04-08 19:03:39 GMT FATAL: lock file "postmaster.pid" already exists
2012-04-08 19:03:39 GMT HINT: Is another postmaster (PID 68) running in data directory "/Library/PostgreSQL/9.1/data"?

bash-3.2$ exit

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...