Xel*_*arK 5 python django postgresql django-1.7
我真的不知道问题是什么.
日志读取
致命:抱歉,已有太多客户
一遍又一遍地.起初我认为有时连接徘徊或没有正确关闭所以我通过连接到数据库并检查在任何给定时间有多少打开的连接测试,并且答案一直是1.
我试图连接到使用数据库的网站,我设法瞥见2或3个打开的连接,这些连接在页面加载完成后立即关闭.
我的另一个猜测是,有时网站的并发连接会出现峰值,导致数据库停止接受新连接,并且不知何时不允许删除当前连接.
我没有写任何与数据库连接的代码,我使用的是一个非常香草的Django(1.7)后端来处理所有的连接.
在搜索谷歌时我找不到任何东西,有没有人遇到过任何问题?
编辑:
重要组成部分:
port = 26445 # (change requires restart)
max_connections = 500 # (change requires restart)
unix_socket_directory = '/home/clearintent/webapps/norr2_db/run' # (change requires restart)
shared_buffers = 32MB # min 128kB
# (change requires restart)
log_destination = 'stderr' # Valid values are combinations of
logging_collector = on # Enable capturing of stderr and csvlog
log_directory = 'pg_log' # directory where log files are written,
log_filename = 'postgresql-%a.log' # log file name pattern,
log_truncate_on_rotation = on # If on, an existing log file with the
log_rotation_age = 1d # Automatic rotation of logfiles will
log_rotation_size = 0 # Automatic rotation of logfiles will
datestyle = 'iso, mdy'
lc_messages = 'C' # locale for system error message
lc_monetary = 'C' # locale for monetary formatting
lc_numeric = 'C' # locale for number formatting
lc_time = 'C' # locale for time formatting
default_text_search_config = 'pg_catalog.english'
Run Code Online (Sandbox Code Playgroud)
听起来好像有什么东西正在攻击你的 PostgreSQL,但这个错误本身并不会导致数据库崩溃。
它只是意味着最新的连接尝试超出了允许的数据库并行连接数量,因此被拒绝。
但是,如果您想转储每分钟的连接量,您可以使用此脚本
#!/bin/bash
function spew_connections() {
# Run psql on local if trust or auth is set.
# Change dbadmin and dbname accordingly.
/usr/bin/psql -d dbname -U dbadmin -w -t -c "SELECT localtimestamp(2), count(*) FROM pg_stat_activity;"
}
echo -n `spew_connections` >> /tmp/connections
echo >> /tmp/connections
Run Code Online (Sandbox Code Playgroud)
然后,每分钟使用 crontab 执行它
crontab -e
*/1 * * * * /path/to/executable/script
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1240 次 |
| 最近记录: |