2012-04-11 3 views
6

Ich habe keine Ahnung, wie ich meine Play 2.0 App so konfigurieren kann, dass ich nicht so viele Datenbankverbindungen für Datenbankentwicklungen und zur Laufzeit verwende. Ich habe das in der Gruppe und im IRC ohne Glück gefragt.playframework 2.0 - Max_user_connections bei Datenbankentwicklungen überschritten?

Ich verwende cleardb Instanz entzünden (max_user_connections = 10) mit Heroku ...

Im Grunde genommen, wenn ich versuche Datenbank Entwicklungen auf mein Spiel 2.0 App zu laufen bekomme ich:

! @6a2mjd7kg - 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.apply(Evolutions.scala:424) ~[play_2.9.1.jar:2.0] 
at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:410) ~[play_2.9.1.jar:2.0] 
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) ~[scala-library.jar:0.11.2] 
at scala.collection.immutable.List.foreach(List.scala:45) ~[scala-library.jar:0.11.2] 
at play.api.db.evolutions.EvolutionsPlugin.onStart(Evolutions.scala:410) ~[play_2.9.1.jar:2.0] 
at play.api.Play$$anonfun$start$1.apply(Play.scala:60) ~[play_2.9.1.jar:2.0] 
[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 - 

! Internal server error, for request [GET /@evolutions/apply/default?redirect=http%3A%2F%2Flocalhost%3A9000%2F] -> 

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: User '52841e548f150d' has exceeded the 'max_user_connections' resource (current value: 10) 
at sun.reflect.GeneratedConstructorAccessor26.newInstance(Unknown Source) ~[na:na] 
at  sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl. java:27) ~[na:1.6.0_29] 
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) ~[na:1.6.0_29] 
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java- 5.1.18.jar:na] 
at com.mysql.jdbc.Util.getInstance(Util.java:386) ~[mysql-connector-java-5.1.18.jar:na] 
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) ~[mysql-connector-java-5.1.18.jar:na] 

Dann habe ich auch oft werden die üblichen „überschritten max_user_connections' bekommen, das sehr häufig geschieht, wenn nicht Evolutionen auch tun

ich auch diese Fehlermeldung erhalten können.

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: User '52841e548f150d' has exceeded the 'max_user_connections' resource (current value: 10) 
at sun.reflect.GeneratedConstructorAccessor19.newInstance(Unknown Source) ~[na:na] 
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) ~[na:1.6.0_29] 
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) ~[na:1.6.0_29] 
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.18.jar:na] 
at com.mysql.jdbc.Util.getInstance(Util.java:386) ~[mysql-connector-java-5.1.18.jar:na] 
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) ~[mysql-connector-java-5.1.18.jar:na] 
[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 - 

Mein application.conf wie folgt aussieht, und ich habe viele Variationen ausprobiert ...

db.default=mysql 
db.default.driver=com.mysql.jdbc.Driver 
db.default.url="mysql://usr:[email protected]_url.com/db_name" 
db.default.minSize=1 
db.default.maxSize=2 

Jede Führung, suggessions, Links, würde an dieser Stelle sehr hilfreich sein ...

+0

ich das gleiche Problem habe. Ein Blick darauf ... –

+0

Ich konnte eine einfache App gegen eine lokale MySQL-Datenbank arbeiten lassen, konnte aber nicht gegen ClearDB arbeiten. Können Sie eine Heroku-Supportanfrage stellen? Hier ist mein Testprojekt: https://github.com/jamesward/play2bars-java/tree/mysql –

Antwort

6

Aktualisiert Antworten.

Hier ist eine Konfiguration, die nur 5 Verbindungen verwendet.

db.default.partitionCount=1 
db.default.maxConnectionsPerPartition=5 
db.default.minConnectionsPerPartition=5 

# Verbindungen werden partitionCount x ConnectionsPerPartition

+0

Kannst du eine Supportanfrage mit Heroku stellen? –

+0

@JamesWard Ich bin mir nicht mehr so ​​sicher, es ist heroku/clearDb, aber wenn du den Server startest oder vs startest, werde ich meine Antwort aktualisieren. – Farmor

+0

Das hat mir geholfen. Ich habe inkonsistent Verbindungsausnahmen erhalten, wenn Tests lokal mit meiner Postgres-Datenbank ausgeführt wurden. – duma

Verwandte Themen