2012-12-27 16 views
8

मैं एक dev PostgreSQL सर्वर सेट अप करने का प्रयास कर रहा हूं। यह चल रहा है और मैं कमांड लाइन से भूमिकाएं, टेबल इत्यादि बनाने में सक्षम हूं। लेकिन जब मैं खेलने का उपयोग कर विकास ने लागू करने का प्रयास, मैं निम्नलिखित त्रुटि मिलती है:PostgreSQL विकास: "PSQLException: FATAL: क्षमा करें, पहले से ही बहुत से ग्राहक"

org.postgresql.util.PSQLException: FATAL: sorry, too many clients already 

मैं कनेक्ट करने में सक्षम हूँ और अगर मैं उद्देश्य पर एक सिंटैक्स त्रुटि में डाल दिया, यह वाक्य रचना त्रुटि देता है तो मुझे लगता है कि खेल पता डेटाबेस से कनेक्ट करने में सक्षम है। हालांकि, विकास सफलतापूर्वक लागू होने के बाद मुझे ऊपर दिखाई गई त्रुटि मिलती है।

मैं पोस्टग्रेएसक्यूएल प्रशासन में बहुत अच्छी तरह से ज्ञात नहीं हूं इसलिए मुझे यकीन नहीं है कि समस्या Play या my PostgreSQL स्थापना के साथ है या नहीं। मैंने बस मैक शेर के मैक पर हेरोकू के पोस्टग्रेस.एप का उपयोग करके इसे इंस्टॉल किया है।

यहाँ कंसोल के लिए लिखा जाता है:

! @6cnb0blpp - Internal server error, for request [GET /] -> 

play.api.db.evolutions.InvalidDatabaseRevision: Database 'default' needs evolution! [An SQL script need to be run on your database.] 
    at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1$$anonfun$apply$1.apply$mcV$sp(Evolutions.scala:427) ~[play_2.9.1.jar:2.0.4] 
    at play.api.db.evolutions.EvolutionsPlugin.withLock(Evolutions.scala:448) ~[play_2.9.1.jar:2.0.4] 
    at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:414) ~[play_2.9.1.jar:2.0.4] 
    at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:412) ~[play_2.9.1.jar:2.0.4] 
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) ~[scala-library.jar:0.11.3] 
    at scala.collection.immutable.List.foreach(List.scala:45) ~[scala-library.jar:0.11.3] 
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 10. Exception: null 
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 9. Exception: null 
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 8. Exception: null 
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 7. Exception: null 
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 6. Exception: null 
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 5. Exception: null 
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 4. Exception: null 
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 3. Exception: null 
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 2. Exception: null 
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 1. Exception: null 
[error] application - 

धन्यवाद!

उत्तर

2

आप अपने आवेदन द्वारा उपयोग किए गए कनेक्शन की संख्या को कम कर सकते हैं। मैक इंस्टॉल पर एक ही त्रुटि थी। के रूप में official documentation में दिखाया गया है: max_connections = को

db.default.partitionCount=2 

# The number of connections to create per partition. Setting this to 
# 5 with 3 partitions means you will have 15 unique connections to the 
# database. Note that BoneCP will not create all these connections in 
# one go but rather start off with minConnectionsPerPartition and 
# gradually increase connections as required. 
db.default.maxConnectionsPerPartition=5 

# The number of initial connections, per partition. 
db.default.minConnectionsPerPartition=5 
+0

मैंने उन सेटिंग्स को अपने application.conf में सेट कर दिया है लेकिन मैं अभी भी एक ही परिणाम के साथ समाप्त होता हूं। मैंने PlaygreSQL से अतीत में Play के साथ कनेक्ट किया है और मुझे यह समस्या कभी नहीं मिली है, मैं वास्तव में स्टंप हूं। – Ryan

5

जीयूसी ("ग्रैंड यूनिफाइड कॉन्फ़िगरेशन") max_connections के साथ स्वीकृत कनेक्शन की संख्या postgresql.conf में सेट की गई है। डिफ़ॉल्ट 100 है।

लेकिन इससे पहले कि आप सेटिंग को श्वेत कर दें, आपको खुद से पूछना चाहिए: आपके क्लस्टर ने सीमा को हिट करने से पहले उन सभी 100 कनेक्शन कहां से आए थे? यह आमतौर पर आपके इंस्टॉलेशन या प्रोग्राम में एक बग की ओर इशारा करता है!

आप पोस्टग्रेस विकी में connection pooling और article about The Number of Connections में रुचि भी ले सकते हैं।

+0

यह एक वेनिला पोस्टग्रेर्स इंस्टॉल है और एक नया प्ले 2.0.4 प्रोजेक्ट है। मेरे पास अभी तक कुछ मॉडल परिभाषित हैं। क्या कोई लॉग है जो मैं यह पता लगाने के लिए देख सकता हूं कि अन्य कनेक्शन कहां से आ रहे हैं? – Ryan

+0

@Ryan: आप बहुत कुछ लॉग इन करने के लिए PostgreSQL सेट अप कर सकते हैं। [यहां मैनुअल पढ़ने से शुरू करें] (http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html)। –

3

Postgres.app चूक से 10 ~/Library/Application Support/Postgres/var/postgresql.conf देखें।

मैंने इसे अधिकतम_कनेक्शन 50 तक बढ़ाकर तय किया। माउंटेन शेर पर मुझे पोस्टग्रेज़ के लिए 500kb पर shared_buffers को भी कम करना पड़ा।