मैं postgresql 9.3 के साथ विकास में एक रेल एप्लिकेशन चला रहा हूं। जब मैंने आज यात्री सर्वर शुरू करने की कोशिश की, मुझे मिल गया:
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?
कोई बड़ी बात मैंने नहीं सोचा था, जो पहले हुआ था। पोस्टगार्ट्स को फिर से शुरू करने से हमेशा समस्या हल हो गई। इसलिए मैं भागा 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चूक के लिए मेरे अंक: localhostऔर बंदरगाह 5432। मैंने बंदरगाह को बदलने की कोशिश की लेकिन त्रुटि संदेश समान है (बंदरगाह परिवर्तन को छोड़कर)।
दोनों ps aux | grep postgresqlऔर ps aux | grep postmasterकुछ भी नहीं।
संपादित करें:
में postgresql.confमैं listen_addressesके 127.0.0.1बजाय बदल दिया है localhostऔर यह चाल, सर्वर को फिर से शुरू किया। मैं भी संपादित करने के लिए करने के लिए अपने आवेदन पत्र 'डाटाबेस config और बिंदु था 127.0.0.1बजाय 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
example.comडोमेन नाम के रूप में उपयोग करें।
sudo netstat -anlp | grep 5432?