简体   繁体   English

django.db.utils.OperationalError:连接到“数据库”处的服务器失败:致命:抱歉,客户端已经太多了

[英]django.db.utils.OperationalError: connection to server at "database" failed: FATAL: sorry, too many clients already

I had a spike of this error in my Django application:我的 Django 应用程序中出现了这个错误:

django.db.utils.OperationalError: connection to server at "name-of-the-db" (172.17.0.11), port 5432 failed: FATAL: sorry, too many clients already My Django app is deployed on dokku and connected to a postgres database. django.db.utils.OperationalError: 在“name-of-the-db” (172.17.0.11) 连接到服务器,端口 5432 失败:致命:抱歉,已经有太多客户端 我的 Django 应用程序部署在 dokku 上并连接到postgres 数据库。 The connection to the db is achieved using dj-datbase-url package and the setting looks like this:使用 dj-datbase-url package 实现与数据库的连接,设置如下所示:

DATABASES = {
    "default": {
        **dj_database_url.parse(
            os.environ.get("DATABASE_URL", False), conn_max_age=600
        ),
        "ATOMIC_REQUESTS": True,
    }
}

I use daphne in front of Django, and I'm running 3 processes with daphne.我在 Django 前面使用了 daphne,并且我正在使用 daphne 运行 3 个进程。

What could have been causing this issue?是什么导致了这个问题?

I have read that a possible solution is to drop the conn_max_age parameter or set it to a lower value, but I'm not sold on it and don't completely understand how it works, so any guidance is welcome.我已经读过一个可能的解决方案是删除 conn_max_age 参数或将其设置为较低的值,但我没有出售它并且不完全理解它是如何工作的,所以欢迎任何指导。

Also, I haven't registered any abnormal traffic on my website, but I'm wondering: is this something that can happen “spontaneously”, maybe due to an incorrect setup, or could it be due to malicious activity?另外,我没有在我的网站上注册任何异常流量,但我想知道:这是否会“自发”发生,可能是由于设置不正确,还是由于恶意活动?

The most likely explanation I can think of is there is some database connection leaks around my app, but I can't figure out how to find them.我能想到的最可能的解释是我的应用程序周围存在一些数据库连接泄漏,但我不知道如何找到它们。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 django.db.utils.OperationalError:致命:数据库“库”不存在 - django.db.utils.OperationalError: FATAL: database “library” does not exist django.db.utils.OperationalError:无法连接到服务器:连接被拒绝 - django.db.utils.OperationalError: could not connect to server: Connection refused django.db.utils.OperationalError:数据库已锁定 - django.db.utils.OperationalError: database is locked Django django.db.utils.OperationalError: FATAL: 剩余的连接槽保留用于非复制超级用户连接 - Django django.db.utils.OperationalError: FATAL: remaining connection slots are reserved for non-replication superuser connections Django 错误:django.db.utils.OperationalError:致命:用户对等身份验证失败 - Django error: django.db.utils.OperationalError: FATAL: Peer authentication failed for user django.db.utils.OperationalError:致命:角色“django”不存在 - django.db.utils.OperationalError: FATAL: role “django” does not exist Django+Postgres FATAL:抱歉,已经有太多客户了 - Django+Postgres FATAL: sorry, too many clients already 将 Django 连接到 Postgres:django.db.utils.OperationalError:致命:数据库“DATABASENAME”不存在 - Connecting Django to Postgres: django.db.utils.OperationalError: FATAL: database "DATABASENAME" does not exist django.db.utils.OperationalError:致命:用户“vagrant”的密码验证失败 - django.db.utils.OperationalError: FATAL: password authentication failed for user “vagrant” django.db.utils.OperationalError: FATAL: password authentication failed for user “postgres” - django.db.utils.OperationalError: FATAL: password authentication failed for user “postgres ”
 
粤ICP备18138465号  © 2020-2023 STACKOOM.COM