惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
雷峰网
雷峰网
博客园_首页
小众软件
小众软件
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
腾讯CDC
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
U
Unit 42
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 叶小钗

博客园 - 冰封的心

华为欧拉安装.net10 设置word中第一页不显示页码,第二页页码从1开始 阿里云OSS图片生成缩略图和获取视频的封面方法 nginx中部署vue3注意事项 pgsql:connection failed: connection to server at “::1“, port 5432 failed: : û “postgres“ P(修改密码) Windows下同版本的postgresql到入data/base目录下的数据库 Dapper添加postgresql分区表错误处理 nginx更新证书 SoybeanAdmin修改 ERR_PNPM_WORKSPACE_PKG_NOT_FOUND 升级vite至最新版 JwtBearerEvents的订阅事件 .net 获取application/json参数 强制覆盖本地代码(与git远程仓库保持一致) JetBrains Resharper关闭行间自动补全 Postgresql序列操作 postgresql重置序列和自增主键 在C#中使用 CancellationToken 处理异步任务 电话脱敏SQL写法
解决postgres数据库remaining connection slots are reserved...
冰封的心 · 2024-05-23 · via 博客园 - 冰封的心

来源:【小工具】 - 解决postgres数据库remaining connection slots are reserved for non-replication superuser connectio-CSDN博客

psycopg2.OperationalError: FATAL: remaining connection slots are reserved for non-replication superuser connection

报错信息

Traceback (most recent call last):
  File "/opt/wavepoint/agent/main.py", line 9, in <module>
    from monitor import moduleMonitor
  File "/opt/wavepoint/agent/monitor/moduleMonitor.py", line 26, in <module>
    from helper.helper_postgresql import postgres_helper
  File "/opt/wavepoint/agent/helper/helper_postgresql.py", line 15, in <module>
    postgres_helper = DBHelper(
  File "/opt/wavepoint/agent/helper/helper_db.py", line 26, in __init__
    self.get_client()
  File "/opt/wavepoint/agent/helper/helper_db.py", line 151, in get_client
    connection = psycopg2.connect(
  File "/opt/wavepoint/data-engine/external-libraries/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL:  remaining connection slots are reserved for non-replication superuser connections

问题分析
从字面意思理解来看,是由于超级用户连接数过多导致的问题。可以增加超级用户连接数限制,或者改用非超级用户进行业务操作(最大连接数设置大一些,比如20000)。

解决方案
解决方案一、增加超级用户连接数
vi /var/lib/postgresql/data/postgresql.conf

max_connections = 20000             
superuser_reserved_connections = 10000    
reserved_user_name = 'airflow' 
解决方案二、增加普通用户连接数

vi /var/lib/postgresql/data/postgresql.conf

max_connections = 20000             
superuser_reserved_connections = 100    
reserved_user_name = 'postgres' 

reserved_user_name为系统内置用户。