我从Play 2.0.3 Java应用程序中得到这个错误。我怎样才能重新启动Heroku Postgres Dev DB?我找不到在Heroku帮助中心重新启动数据库的任何说明。
应用程序[web.1]:导致:org.postgresql.util.PSQLException:致命:剩余的连接插槽被保留用于非复制超级用户连接解决方案
不是重新启动数据库的原因;这不是数据库问题。您的应用程序持有太多连接,可能是因为您忘记设置连接池。这不是数据库服务器问题,您可以在不重新启动数据库服务器的情况下修复它。
如果停止Play应用程序或重新配置其连接池,问题将消失。
另一个选择是将Heroku实例置于维护模式,然后再次取出。
由于 heroku不允许你以超级用户身份进行连接(出于很好的理由)你可以' t使用该保留的超级用户插槽来连接和管理连接,就像使用普通PostgreSQL一样。
另请参见:
Heroku" psql:致命:剩余的连接插槽为非复制超级用户连接保留
wiki.postgresql/wiki/Number_Of_Database_Connections
如果您是非Herku用户谁发现这一点:使用普通的PostgreSQL,您可以使用与服务器的PostgreSQL连接将客户端从服务器端断开连接。看看它是如何为超级用户连接保留一个插槽?以PgAdmin-III或 psql 的身份以超级用户身份连接到Pg(默认情况下为 postgres 用户)。
连接后,您可以看到其他客户:
SELECT * FROM pg_stat_activity ;如果你想终止除你自己以外的每一个连接,你可以运行:
SELECT procpid,pg_terminate_backend(procpid) FROM pg_stat_activity WHERE procpid<> pg_backend_pid();添加 AND datname = current_database 和/或 AND usename =< target-user-name> 。
I got this error from an Play 2.0.3 java application. How could I restart Heroku Postgres Dev DB? I could not find any instructions to restart the DB on Heroku help center.
app[web.1]: Caused by: org.postgresql.util.PSQLException: FATAL: remaining connection slots are reserved for non-replication superuser connections解决方案
The error mesage you have there isn't a reason to restart the database; it isn't a database problem. Your application is holding too many connections, probably because you forgot to set up its connection pool. That isn't a DB server problem and you can fix it without restarting the DB server.
If you stop your Play application or reconfigure its connection pool the problem will go away.
Another option is to put your Heroku instance in maintenance mode then take it out again.
Since heroku doesn't allow you to connect as a superuser (for good reasons) you can't use that reserved superuser slot to connect and manage connections like you would with normal PostgreSQL.
See also:
Heroku "psql: FATAL: remaining connection slots are reserved for non-replication superuser connections"
wiki.postgresql/wiki/Number_Of_Database_Connections
If you're a non-heroku user who found this:With normal PostgreSQL you can disconnect your client from the server end end using a PostgreSQL connection to your server. See how it says there's a slot reserved for "superuser connections" ? Connect to Pg as a superuser (postgres user by default) using PgAdmin-III or psql.
Once you're connected you can see other clients with:
SELECT * FROM pg_stat_activity;If you want to terminate every connection except your own you can run:
SELECT procpid, pg_terminate_backend(procpid) FROM pg_stat_activity WHERE procpid <> pg_backend_pid();Add AND datname = current_database and/or AND usename = <target-user-name> as appropriate.
更多推荐
重新启动Heroku Postgres Dev DB
发布评论