3

我遇到了与( playframework 2.0 - 在数据库演化上超出 max_user_connections? )完全相同的问题,只是这次是本地 postgres 安装。我在集线器@ 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]

当我查看数据库时,我看到所有连接实际上都被进程用完了。

任何帮助将不胜感激。

谢谢。

4

2 回答 2

2

尝试减少您的 Play 应用使用的连接数。

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

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

基本上连接数将是partitionCount x ConnectionsPerPartition

于 2012-04-25T07:07:23.640 回答
2

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

db.default.user=sa

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

于 2012-05-04T21:50:41.153 回答