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

推荐订阅源

WordPress大学
WordPress大学
GbyAI
GbyAI
P
Proofpoint News Feed
B
Blog
MyScale Blog
MyScale Blog
V
V2EX
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
量子位
Jina AI
Jina AI
博客园 - 叶小钗
Recent Announcements
Recent Announcements
有赞技术团队
有赞技术团队
罗磊的独立博客
L
LangChain Blog
I
InfoQ
云风的 BLOG
云风的 BLOG
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
人人都是产品经理
人人都是产品经理
小众软件
小众软件
V
Visual Studio Blog
月光博客
月光博客
The Cloudflare 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为系统内置用户。