playframework 2.0 - 超出数据库演进的max_user_connections(使用本地postgres服务器)

时间:2012-04-24 17:55:07

标签: heroku playframework playframework-2.0 postgresql-9.1

我遇到的问题与(playframework 2.0 - exceeded max_user_connections on database evolutions?)完全相同,这次只是本地postgres安装。我有一个示例应用程序,我在hub http://git.io/CdEntA上发布了。

我尝试使用

在本地运行它
sbt stage
target/start -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -  Ddb.default.url="jdbc:postgresql://localhost:5432/test?user=myuser"

当我启动http://localhost:9000时,我在控制台上看到的只是......

[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: 10. Exception: null [info] play - Application started (Prod) [info] play - Listening for HTTP on port 9000... [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] c.j.b.PoolWatchThread - Error in trying to obtain a connection. Retrying in 1000ms org.postgresql.util.PSQLException: FATAL: sorry, too many clients already at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:293) ~[postgresql-9.1-901-1.jdbc4.jar:na]

当我查看数据库时,我发现所有连接实际上都被该过程耗尽。

非常感谢任何帮助。

感谢。

2 个答案:

答案 0 :(得分:2)

尝试减少播放应用使用的连接数。

这是仅使用5个连接的配置。

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

基本上连接数为partitionCount x ConnectionsPerPartition

答案 1 :(得分:2)

我相信您的问题是您没有覆盖db.default.user配置参数,因此它使用sa值。只需注释掉conf/application.conf文件中的以下行:

db.default.user=sa

一旦我这样做并重新运行sbt stage,那么它对我来说很好。