postgresql 9.3으로 개발중인 Rails 앱을 실행하고 있습니다. 오늘 여객 서버를 시작하려고했을 때
PG::ConnectionBad - could not connect to server: Connection refused
Is the server running on host "localhost" (217.74.65.145) and accepting
TCP/IP connections on port 5432?
내가 생각한 큰 일은 없었습니다. postgres를 다시 시작하면 항상 문제가 해결되었습니다. 그래서 나는 달렸다 sudo service postgresql restart.
* Restarting PostgreSQL 9.3 database server
* The PostgreSQL server failed to start. Please check the log output:
2014-06-11 10:32:41 CEST LOG: could not bind IPv4 socket: Cannot assign requested address
2014-06-11 10:32:41 CEST HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2014-06-11 10:32:41 CEST WARNING: could not create listen socket for "localhost"
2014-06-11 10:32:41 CEST FATAL: could not create any TCP/IP sockets
...fail!
내 postgresql.conf기본값은 localhostand port 5432입니다. 포트 변경을 시도했지만 오류 메시지는 동일합니다 (포트 변경 제외).
모두 ps aux | grep postgresql와 ps aux | grep postmaster반환 아무것도.
편집하다:
에서 postgresql.conf내가 변경 listen_addresses에 127.0.0.1대신 localhost하고 속임수를 썼는지, 서버가 다시 시작됩니다. 또한 응용 프로그램의 db 구성을 편집하고 127.0.0.1대신 가리켜 야했습니다 localhost. 그러나 문제는 이제 localhost가 왜 217.74.65.145아닌 것으로 간주 127.0.0.1됩니까?
그건 내를이다 /etc/hosts:
127.0.0.1 local
127.0.1.1 jacek-X501A1
127.0.0.1 something.name.non.example.com
127.0.0.1 company.something.name.non.example.com
데이터를 난독 처리하려면 책임감있게 수행하고
—
Jenny D
example.com도메인 이름으로 사용하십시오.
sudo netstat -anlp | grep 5432?의 출력