node.js - 错误 : sorry, 已经有太多客户端

标签 node.js postgresql pg

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

 connection error error: sorry, too many clients already.

PostgresSQL 连接配置

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

由于上述错误,我无法查询数据库。我无法解决这个问题。你能提出解决方案吗

最佳答案

下面的查询会帮助你。

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

关于node.js - 错误 : sorry, 已经有太多客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50947066/

相关文章:

javascript - 如何使用 Browserify 指定自定义搜索路径?

Javascript 日期解析错误?

sql - 如何在其他过程中使用存储过程中创建的查询

php - 可以在 FreeBSD 10.3 中安装没有依赖项的 pkg 吗?

ruby-on-rails - Postgresql 适配器 (pg) : could not connect to server

ruby-on-rails - "rake db:migrate"结果为 "The bundle currently has pg locked at 0.18.4"

node.js - 使用 Passport JS 的邀请系统

node.js - 快速路由器参数验证

c# - TEXT 字段中的错误 (PostgreSQL) - NHibernate 无法读取它

ruby-on-rails - Rails pg gem,安装pg时出错