remaining connection slots are reserved for non-replication superuser connections

使用客戶端工具鏈接pg,鏈接失敗,報錯如下錯誤:sql

FATAL: remaining connection slots are reserved for non-replication superuser connections 

查看數據庫鏈接狀態和配置信息數據庫

select * from pg_stat_activity where pid<>pg_backend_pid() and state='idle';##pg_backend_pid()的結果是當前會話的pid
select datname,datconnlimit from pg_database ;
select current_setting('max_connections');
select current_setting('superuser_reserved_connections');

  

發現參數max_connections設置過低。工具

由於是測試環境,就先把idle狀態的鏈接先殺掉:測試

##把數據庫中的全部的空閒會話所有kill掉
select pg_terminate_backend(pid) from pg_stat_activity where pid<>pg_backend_pid() and state='idle';

 而後修改參數max_connections的值。blog

相關文章
相關標籤/搜索