File "/usr/local/lib/python3.7/dist-packages/psycopg2/__init__.py", line 126, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL: remaining connection slots are reserved for non-replication superuser connections
根据Postgres文档,当Django与Postgres DB建立更多连接时,会发生此错误,而这是默认连接限制。
#settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'xxxxx',
'USER': 'xxxxx',
'PASSWORD':'xxxxx',
'HOST':'localhost',
'PORT':'5432',
}
我相信,鉴于Django框架不进行数据库池化,这种情况正在发生。研究Django文档(https://docs.djangoproject.com/en/3.0/ref/databases/#transaction-pooling-and-server-side-cursors)我可以找到对pgBouncer用户的建议(http:// www .pgbouncer.org /)进行处理。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句