Jebus. This one wasted 4 hours and was a terrible terrible experience. Absolute frustration.
If I can understand all of this one day, I will be extremely proud. People who work on these systems are ridiculous geniuses.
I was getting ready to move our software to the live server but for some reason the postgresql server died on it. Checking up on logs shows that the server lost available memory and oom-killer, well, killed stuff.
So, upon restarting, postgresql would not start, giving me this error: could not bind apv4 socket: cannot assign requested address
Is postmaster listening on 5432? no its not lsof -i :5432 shows nothing. So whats up?
After reading posts after posts (most people suggest “you are probably already running postmaster”) I came upon an obscure reference to localhost not being resolvable.
ping localhost… nothing happens. There’s our problem.
Turns out its been running fine for months w/o a restart, and I had a wrong settings in /etc/network/interfaces
I had my iptables rules not auto-loading because I spelled the script ‘itables’ instead of ‘iptables’.
So.. bottom line? check to see if you can ping localhost.
Very helpful information! Thank you!
Hey I’m glad it helped! I was going through sheer panic when this happened to the production server.
You just freaking saved my life man. I was absurdly grateful to find this hint. You rock!
Thank u very much…. I too did the same mistake…
Tons of thanks…
I’m super glad it helped man. I was freaking out when this happened.
You’re my hero!
Same problem as you described. Fixed up the dns resolve and its works.
Again you’re my hero of the day
Yuji. I like to customize my machine and turned off my localhost. Thank you sir. Great help!!!
It is now 2017, and this is as relevant as it get. In my case it was a configuration mistake that didn’t bring lo up, but thinking that localhost wasn’t accessible was not in my list of things to check.