My Play应用程序在带有clearDB的Heroku上工作了一段时间。然后它崩溃了错误
has exceeded the 'max_user_connections' resource
我按照这篇文章中的说明进行了操作
playframework 2.0 - exceeded max_user_connections on database evolutions?
然而,问题没有解决。我甚至尝试将此配置添加到Procfile中。
我可以通过MySQL工作台连接到我的数据库,所以当我的应用程序关闭时问题似乎不会持续存在。
尝试重启时的日志输出如下:
State changed from crashed to starting
Starting process with command `target/universal/stage/bin/listbucket -Dhttp.port=${PORT} -Ddb.default.driver=com.mysql.jdbc.Driver -Ddb.default.url=${CLEARDB_DATABASE_URL} -Ddb.default.partitionCount=1 -Ddb.default.maxConnectionsPerPartition=5 -Ddb.default.minConnectionsPerPartition=5`
Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCodebaseOnly=true
Play server process ID is 2
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 10. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 9. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 8. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 7. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 6. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 5. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 4. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 3. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 2. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 1. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:92)
at play.api.Configuration.reportError(Configuration.scala:570)
Configuration error: Configuration error[Cannot connect to database [default]]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.immutable.List.foreach(List.scala:318)
Oops, cannot start the server.
at scala.collection.immutable.List.foreach(List.scala:318)
at play.api.Play$$anonfun$start$1.apply(Play.scala:88)
at play.utils.Threads$.withContextClassLoader(Threads.scala:18)
at play.core.StaticApplication.<init>(ApplicationProvider.scala:52)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:88)
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:243)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:88)
at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:274)
at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:279)
at play.core.server.NettyServer$.main(NettyServer.scala:274)
at play.core.server.NettyServer$.createServer(NettyServer.scala:243)
at play.core.server.NettyServer.main(NettyServer.scala)
at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:88)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.Option.map(Option.scala:145)
at play.api.Play$$anonfun$start$1.apply(Play.scala:88)
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:252)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at play.api.db.BoneCPPlugin.onStart(DB.scala:243)
at play.api.Play$.start(Play.scala:87)
State changed from starting to crashed
Process exited with status 255
State changed from crashed to starting
Starting process with command `target/universal/stage/bin/listbucket -Dhttp.port=${PORT} -Ddb.default.driver=com.mysql.jdbc.Driver -Ddb.default.url=${CLEARDB_DATABASE_URL} -Ddb.default.partitionCount=1 -Ddb.default.maxConnectionsPerPartition=5 -Ddb.default.minConnectionsPerPartition=5`
Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCodebaseOnly=true
Play server process ID is 2
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and t
rying again. Attempts left: 10. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 9. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 8. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 7. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 6. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 5. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 4. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 3. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 2. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_f176dd782ce596b?reconnect=true Sleeping for 1000ms and trying again. Attempts left: 1. Exception: null.Message:User 'b6cf16f10a7a77' has exceeded the 'max_user_connections' resource (current value: 10)
Heroku几乎是一个又一个令人头痛的问题,所以任何帮助都会非常感激,因为这对我来说是Heroku的最后一根稻草。
答案 0 :(得分:1)
您需要在* .conf文件中编辑db.default的分区连接。
请参阅文档here。
你会对这三个感兴趣。
# In order to reduce lock contention and thus improve performance,
# each incoming connection request picks off a connection from a
# pool that has thread-affinity.
# The higher this number, the better your performance will be for the
# case when you have plenty of short-lived threads.
# Beyond a certain threshold, maintenance of these pools will start
# to have a negative effect on performance (and only for the case
# when connections on a partition start running out).
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