使用客户端工具链接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