2012-12-27 3 views
8

Ich versuche, einen dev PostgreSQL-Server einzurichten. Es läuft und ich kann Rollen, Tabellen usw. von der Kommandozeile aus erstellen. Allerdings, wenn ich versuche Entwicklungen anwenden Wiedergabe verwenden, erhalte ich folgende Fehlermeldung:PostgreSQL Entwicklungen: "PSQLException: FATAL: sorry, zu viele Kunden bereits"

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

ich in der Lage bin zu verbinden und wenn ich absichtlich in einem Syntaxfehler gesetzt, es gibt die Syntax-Fehler, damit ich, dass das Spiel wissen kann sich mit der Datenbank verbinden. Nachdem die Evolution erfolgreich angewendet wurde, erhalte ich den oben gezeigten Fehler.

Ich bin nicht sehr gut in PostgreSQL-Verwaltung, so dass ich nicht sicher bin, ob das Problem mit Play oder meine PostgreSQL-Installation ist. Ich habe es gerade mit Herokus Postgres.app auf einem Mac mit Mountain Lion installiert.

Hier ist, was auf die Konsole geschrieben wird:

! @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 - 

Dank!

Antwort

2

Sie können die Anzahl der von Ihrer Anwendung verwendeten Verbindungen reduzieren. Hatte die gleichen Fehler auf einem Mac installiert. Wie in der official documentation gezeigt:

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

Ich habe diese Einstellungen in meiner application.conf eingestellt, aber ich habe immer noch das gleiche Ergebnis. Ich habe PostgreSQL in der Vergangenheit mit Play verbunden und ich hatte dieses Problem nie, ich bin wirklich ratlos. – Ryan

5

Die Anzahl der zulässigen Verbindungen wird in postgresql.conf mit der GUC ("Grand Unified Configuration") max_connections eingestellt. Standard ist 100.

Aber bevor Sie mit der Einstellung basteln, müssen Sie sich fragen: Wo kamen all diese anderen 100 Verbindungen her, bevor Ihr Cluster das Limit erreichte? Das deutet normalerweise auf einen Fehler in Ihrer Installation oder Ihrem Programm hin!

Sie könnten auch interessiert sein an connection pooling und diese article about The Number of Connections in der Postgres-Wiki.

+0

Es ist eine Vanille Postgres Installation und ein brandneues Play 2.0.4 Projekt. Alles, was ich bisher habe, sind einige Modelle definiert. Gibt es ein Protokoll, in das ich schauen kann, um herauszufinden, woher die anderen Verbindungen kommen? – Ryan

+0

@Ryan: Sie können PostgreSQL einrichten, um so ziemlich alles zu protokollieren. [Beginnen Sie, indem Sie das Handbuch hier lesen] (http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html). –

3

Postgres.app standardmäßig max_connections = 10. ~/Library/Application Support/Postgres/var/postgresql.conf See.

Ich habe dies behoben, indem ich max_connections auf 50 erhöht habe. Auf Mountain Lion musste ich shared_buffers auf 500kB reduzieren, damit Postgres starten konnte.

Verwandte Themen