playframework 2.0 - 超过数据库变阵MAX_USER_CONNECTIONS(与

2019-09-16 17:41发布

我有完全相同的问题,因为( 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://本地主机: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]

当我偷看到数据库中,我看到的所有连接都在事实上进程使用了​​。

任何帮助,不胜感激。

谢谢。

Answer 1:

我相信你的问题是,你是不是重写db.default.user所以它的使用配置参数sa值。 注释掉下面一行在你conf/application.conf文件:

db.default.user=sa

一旦我做到了,并重新运行sbt stage ,然后对我来说工作得很好。



Answer 2:

尝试减少您的游戏应用程序使用的连接数。

这里是仅使用5个连接的结构。

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

基本上连接的数量将是partitionCount x ConnectionsPerPartition



文章来源: playframework 2.0 - exceeded max_user_connections on database evolutions (with local postgres server)