我在一个PostgreSQL实例中遇到了错误 "remaining connection slots are reserved for non-replication superuser connections"。
然而,当我从超级用户运行以下查询以检查可用连接时,我发现有足够的连接。但仍然出现相同的错误。
select max_conn,used,res_for_super,max_conn-used-res_for_super
res_for_normal
from
(select count(*) used from pg_stat_activity) t1,
(select setting::int res_for_super from pg_settings where
name='superuser_reserved_connections') t2,
(select setting::int max_conn from pg_settings where name='max_connections') t3
输出
我搜索了这个错误,每个人都建议增加最大连接数,如下链接所示。 Heroku "psql: FATAL: remaining connection slots are reserved for non-replication superuser connections"
编辑
我重新启动了服务器,一段时间后使用的连接几乎达到了210个,但我仍然能够从普通用户连接到服务器。