aws resource_error ai_generated true

致命错误:剩余的连接槽位保留给非复制超级用户连接(RDS Proxy)

FATAL: remaining connection slots are reserved for non-replication superuser connections (RDS Proxy)

ID: aws/rds-proxy-max-connections-exceeded

其他格式: JSON · Markdown 中文 · English
85%修复率
88%置信度
1证据数
2023-08-10首次发现

版本兼容性

版本状态引入弃用备注
RDS Proxy (2023-03-15) active
PostgreSQL 13.12 active
MySQL 8.0.35 active

根因分析

RDS Proxy 已耗尽最大连接池大小(默认 100),原因是来自应用程序的并发连接过多,并且数据库实例本身也达到了 max_connections 限制。

English

The RDS Proxy has exhausted its maximum connection pool size (default 100) due to too many concurrent connections from applications, and the database instance itself is also at its max_connections limit.

generic

官方文档

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html

解决方案

  1. 通过 AWS 控制台或 CLI 增加 RDS Proxy 的 MaxConnectionsPercent 和 SessionPinningFilters:`aws rds modify-db-proxy --db-proxy-name my-proxy --max-connections-percent 120`。同时确保 RDS 实例的 max_connections 至少是代理限制的 1.5 倍。
  2. 在应用程序中使用连接池库(如 Java 的 HikariCP 或 PostgreSQL 的 pgBouncer)来减少对代理的并发连接数。例如:在 HikariCP 配置中设置 `maximumPoolSize=10`。
  3. 使用 RDS Proxy 的 CloudWatch 指标(例如 'DatabaseConnections')监控活动连接,并在需要时将数据库实例扩展到更大的尺寸。

无效尝试

常见但无效的做法:

  1. 60% 失败

    Increasing only the RDS instance's max_connections without adjusting RDS Proxy's MaxConnectionsPercent will still cause the proxy to reject connections.

  2. 75% 失败

    Restarting the RDS Proxy without scaling the instance or reducing application connections will result in the same error immediately after restart.

  3. 35% 失败

    Assuming the error is a database authentication issue and resetting credentials, which does not address the connection limit.