"致命:数据库系统正在关闭",同时创建与PostgreSQL的连接

Dan*_*Dan 7 postgresql jdbc postgresql-9.2

FATAL: the database system is shutting down在创建与PostgreSQL 9.2服务器的PostgreSQL JDBC连接时遇到错误.我从JDBC获得的特定异常路径在这里:

Caused by: org.postgresql.util.PSQLException: FATAL: the database system is shutting down
    at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:398)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:173)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136)
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
    at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
    at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)
    at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
    at org.postgresql.Driver.makeConnection(Driver.java:393)
    at org.postgresql.Driver.connect(Driver.java:267)
Run Code Online (Sandbox Code Playgroud)

从各种日志文件(来自PostgreSQL,来自我们的管理层,来自使用PostgreSQL的应用程序),我没有看到任何数据库关闭实际发生(其他连接像往常一样创建到PostgreSQL,没有从我们的管理层启动关闭等. ),但是在PostgreSQL服务器日志中,我确实看到了具有相同时间戳的错误消息:

2014-06-16 12:30:00.736 GMT LOG:  connection received: host=127.0.0.1 port=38530
2014-06-16 12:30:00.737 GMT FATAL:  the database system is shutting down
Run Code Online (Sandbox Code Playgroud)

在线研究,我了解到每当PostgreSQL关闭连接时都会使用此错误消息.

为什么PostgreSQL会拒绝给我一个新连接?这可能是由某种资源争用引起的吗?如何从PostgreSQL本身获取有关错误的更多信息?

Dan*_*Dan 7

这个问题原因是由于我们的服务器在同一个数据目录上启动了两个PostgreSQL实例(它已经删除postmaster.pid并使用了新的端口号,因此绕过了这种行为的正常保护措施被绕过),导致PostgreSQL的误操作非常糟糕.为什么日志没有任何有用的信息 - 它们被PostgreSQL实例覆盖,而不是拒绝连接.实际问题是由竞争的PostgreSQL实例之间的复杂交互引起的,我希望其他人也不会遇到这个问题!

  • 修复它的解决方案是什么? (7认同)