错误:抱歉,已经有太多客户 [英] Error: sorry, too many clients already

查看:92
本文介绍了错误:抱歉,已经有太多客户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在NodeJS后端服务中使用PostgreSQL。突然,当我启动服务时,我遇到以下错误

I am using PostgreSQL in my NodeJS backend service. All of sudden, when I start the service I am facing below error

 connection error error: sorry, too many clients already.

PostgresSQL连接配置

PostgresSQL connection config

 const pg = require("pg");
 const client = new pg.Client({
        host: "txslmxxxda6z",
        user: "mom",
        password: "mom",
        db: "mom",
        port: 5025
 });

由于上述错误,我无法查询数据库。我无法解决此问题。您能否建议解决方案

I am unable to query database because of the above error. I am unable to fix this issue. Can you please suggest the solution

推荐答案

以下查询将为您提供帮助。

below query will help you.

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

这篇关于错误:抱歉,已经有太多客户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆