Postgresql 9.3 ile bir ray uygulaması geliştiriyorum. Bugün yolcu sunucusunu başlatmaya çalıştığımda:
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?
Hiçbir şey düşünmedim, bu daha önce oldu. Postgres'i yeniden başlatmak her zaman sorunu çözdü. Bu yüzden koştum sudo service postgresql restartve aldım:
* 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!
Benim postgresql.confvarsayılanlarım: localhostve bağlantı noktası 5432. Bağlantı noktasını değiştirmeyi denedim ama hata mesajı aynı (bağlantı noktası değişikliği hariç).
Her ikisi de ps aux | grep postgresqlve ps aux | grep postmasterhiçbir şey iade.
DÜZENLE:
Gelen postgresql.confDeğiştim listen_addressesiçin 127.0.0.1yerine localhostve hile yaptı, sunucu yeniden. Ayrıca uygulamalarımın db config düzenlemek ve 127.0.0.1yerine işaret etmek zorunda kaldı localhost. Ancak soru şu ki, neden yerel ana bilgisayar olarak kabul ediliyor 217.74.65.145ve değil 127.0.0.1?
Bu benim /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
example.comalan adı olarak kullanın .
sudo netstat -anlp | grep 5432?