2012-04-11 20 views
6

Oyunum 2.0 uygulamamı, hem veritabanı gelişmelerinde hem de çalışma zamanında çok fazla veritabanı bağlantısı kullanmamak için nasıl yapılandırabileceğime dair herhangi bir fikirden bahsediyorum. Bunu grupta ve IRC'de şanssız olarak sordum. Benim oyunda 2.0 app veritabanı açılımlar çalıştırmayı denediğinizdeplayframework 2.0 - veritabanı evrimleri üzerinde max_user_connections aşıldı?

Ben cleardb örneği ateşlemek kullanıyorum (max_user_connections = 10) Heroku ile ...

Temelde alıyorum:

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

Sonra da ben Ayrıca açılımlar yapmıyor zaman genellikle çok sık zamanki "aşıldı max_user_connections' Böyle alacak ben de bu hata mesajını alabilirsiniz

.

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 - 

Benim dosyasına koyarak şöyle, ben çok varyasyon denedi ...

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 

Herhangi bir rehberlik, suggessions, bağlantı, bu noktada son derece yararlı olacaktır ...

+0

olacaktır. Ona bakarak ... –

+0

Yerel bir mysql veritabanına karşı basit bir uygulama çalışması yapabildim ama ClearDB'ye karşı çalışamıyorum. Bir Heroku destek talebi dosyalayabilir misin? İşte benim test projem: https://github.com/jamesward/play2bars-java/tree/mysql –

cevap

6

Güncellendi Cevap.

Burada yalnızca 5 bağlantı kullanan bir yapılandırma bulunmaktadır.

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

# Bağlantılar Ben aynı sorunu yaşıyorum partitionCount x ConnectionsPerPartition

+0

Heroku ile bir destek talebi kaydedebilir misiniz? –

+0

@JamesWard Artık o kadar emin değilim ki, heroku/clearDb ancak sunucu başlamasına başladığınızda ben de cevapımı güncelleyeceğim. – Farmor

+0

Bu bana yardımcı oldu. PostGres veritabanına karşı yerel olarak testler yürütürken tutarsız bir şekilde bağlantı istisnaları alıyorum. – duma