我的实例的最大连接数为16.一旦我意识到我有 19 连接,我就匆匆杀了一个,结果打开了一个具有相同优先级的标准连接和限制。
我现在已达到绝对最大连接数, 20 ,甚至无法执行pg:ps
或pg:killall
。
如何终止所有连接,或者现在做什么来降低连接数?似乎是阻塞的查询非常长(看起来像一个有{410}条目的表的select *
。
$ heroku pg:info -a XYZ
=== HEROKU_POSTGRESQL_COBALT_URL (DATABASE_URL)
Plan: Basic
Status: Available
Connections: 19
PG Version: 9.1.11
Created: 2013-03-12 15:11 UTC
Data Size: 7.16 GB
Tables: 103
Fork/Follow: Unsupported
Rollback: Unsupported
$ heroku pg:ps -a XYZ
procpid | source | running_for | waiting | (...)
$ heroku pg:kill 12593 -a XYZ
pg_cancel_backend
-------------------
t
(1 row)
$ heroku pg:ps -a XYZ
psql: FATAL: too many connections for role "abc"
! Heroku client internal error.
! Search for help at: https://help.heroku.com
! Or report a bug at: https://github.com/heroku/heroku/issues/new
Error: undefined method `[]' for nil:NilClass (NoMethodError)
Backtrace: /home/chris/.heroku/client/lib/heroku/command/pg.rb:442:in `version'
/home/chris/.heroku/client/lib/heroku/command/pg.rb:447:in `nine_two?'
/home/chris/.heroku/client/lib/heroku/command/pg.rb:451:in `pid_column'
/home/chris/.heroku/client/lib/heroku/command/pg.rb:226:in `ps'
/home/chris/.heroku/client/lib/heroku/command.rb:218:in `run'
/home/chris/.heroku/client/lib/heroku/cli.rb:37:in `start'
/usr/local/heroku/bin/heroku:24:in `<main>'
Command: heroku pg:ps -a XYZ
Version: heroku-toolbelt/3.9.6 (x86_64-linux) ruby/2.0.0
$ heroku pg:killall -a XYZ
psql: FATAL: too many connections for role "abc"
! Heroku client internal error.
! Search for help at: https://help.heroku.com
! Or report a bug at: https://github.com/heroku/heroku/issues/new
Error: undefined method `[]' for nil:NilClass (NoMethodError)
Backtrace: /home/chris/.heroku/client/lib/heroku/command/pg.rb:442:in `version'
/home/chris/.heroku/client/lib/heroku/command/pg.rb:447:in `nine_two?'
/home/chris/.heroku/client/lib/heroku/command/pg.rb:451:in `pid_column'
/home/chris/.heroku/client/lib/heroku/command/pg.rb:272:in `killall'
/home/chris/.heroku/client/lib/heroku/command.rb:218:in `run'
/home/chris/.heroku/client/lib/heroku/cli.rb:37:in `start'
/usr/local/heroku/bin/heroku:24:in `<main>'
Command: heroku pg:killall -a XYZ
Version: heroku-toolbelt/3.9.6 (x86_64-linux) ruby/2.0.0
$ heroku pg:info -a XYZ
=== HEROKU_POSTGRESQL_COBALT_URL (DATABASE_URL)
Plan: Basic
Status: Available
Connections: 20
PG Version: 9.1.11
Created: 2013-03-12 15:11 UTC
Data Size: 8.24 GB
Tables: 103
Fork/Follow: Unsupported
Rollback: Unsupported
答案 0 :(得分:0)
我抓住了以下工具带附加组件,它完美无缺。
答案 1 :(得分:-1)
我的解决方案是推广另一个数据库并再次分配原文
heroku addons:add heroku-postgresql:hobby-basic
#Attached as NEW_DATABASE_URL
heroku pg:promote NEW_DATABASE_URL
heroku pg:promote ORIGINAL_DATABASE_URL
然后验证您的数据库连接