码迷,mamicode.com
首页 > 数据库 > 详细

postgresql 致命错误: 已保留的连接位置为执行非复制请求的超级用户预留

时间:2015-08-28 00:57:12      阅读:303      评论:0      收藏:0      [点我收藏+]

标签:postgresql   数据库   最大连接数   数据库连接数   

最近监控系统的数据库监控总是延迟,查看日志报错:

2015-08-27 10:20:19,534 ERROR Traceback (most recent call last):
  File "oracle_mon.py", line 306, in <module>
    update_status(ip, ‘stop‘, timer.end_date)
  File "oracle_mon.py", line 285, in update_status
    pg.db.update("oracle_mon", where=where, status=status, stat_date=status_date)
  File "/usr/lib/python2.7/site-packages/web/db.py", line 881, in update
    db_cursor = self._db_cursor()
  File "/usr/lib/python2.7/site-packages/web/db.py", line 566, in _db_cursor
    return self.ctx.db.cursor()
  File "/usr/lib/python2.7/site-packages/web/db.py", line 507, in _getctx
    self._load_context(self._ctx)
  File "/usr/lib/python2.7/site-packages/web/db.py", line 516, in _load_context
    ctx.db = self._connect_with_pooling(self.keywords)
  File "/usr/lib/python2.7/site-packages/web/db.py", line 970, in _connect_with_pooling
    conn = DB._connect_with_pooling(self, keywords)
  File "/usr/lib/python2.7/site-packages/web/db.py", line 563, in _connect_with_pooling
    return self._pooleddb.connection()
  File "/usr/lib/python2.7/site-packages/DBUtils-1.1-py2.7.egg/DBUtils/PooledDB.py", line 331, in connection
    con = self.steady_connection()
  File "/usr/lib/python2.7/site-packages/DBUtils-1.1-py2.7.egg/DBUtils/PooledDB.py", line 279, in steady_connection
    *self._args, **self._kwargs)
  File "/usr/lib/python2.7/site-packages/DBUtils-1.1-py2.7.egg/DBUtils/SteadyDB.py", line 134, in connect
    failures, ping, closeable, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/DBUtils-1.1-py2.7.egg/DBUtils/SteadyDB.py", line 186, in __init__
    self._store(self._create())
  File "/usr/lib/python2.7/site-packages/DBUtils-1.1-py2.7.egg/DBUtils/SteadyDB.py", line 190, in _create
    con = self._creator(*self._args, **self._kwargs)
  File "/usr/lib64/python2.7/site-packages/psycopg2/__init__.py", line 179, in connect
    connection_factory=connection_factory, async=async)
OperationalError: 致命错误:  已保留的连接位置为执行非复制请求的超级用户预留

查到数据库使用的活动连接数为90左右,而pg的默认最大连接数MAX_CONNECTION=100,怀疑是数据库连接数过多导致报错。

事实果然如此,老数据库的MAX_CONNECTION=200,并没有使用默认的100。

解决办法:修改配置文件(postgresql.conf)中的默认最大连接数MAX_CONNECTION=200,重启数据库即可。

版权声明:本文为博主原创文章,未经博主允许不得转载。

postgresql 致命错误: 已保留的连接位置为执行非复制请求的超级用户预留

标签:postgresql   数据库   最大连接数   数据库连接数   

原文地址:http://blog.csdn.net/kmust20093211/article/details/48037819

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!