【发布时间】:2020-05-25 13:19:28
【问题描述】:
当我的 Rails 应用程序部署在 AWS ECS 中时,我遇到了问题。许多请求以200 结束,但也有一些(例如50 个)以500 结束。日志说:
ActiveRecord::ConnectionNotEstablished (No connection pool with 'primary' found.)
我将池(在database.yml 配置中)更改为 15,还将 RAILS_MAX_THREADS 设置为 15,确实现在很少发生,但问题仍然存在。
我在这里错过了什么?
Ruby 版本:2.6.6 Postgres:11.5
数据库.yml:
production:
adapter: postgresql
encoding: utf8
database: <%= ENV['DB_NAME'] %>
username: <%= ENV['DB_USERNAME'] %>
password: <%= ENV['DB_PASSWORD'] %>
host: <%= ENV['DB_HOSTNAME'] %>
port: <%= ENV['DB_PORT'] %>
pool: 25
【问题讨论】:
-
愿意分享 database.yml 吗?
-
不好意思之前没做过,问题更新了
-
你也安装了pg gem吗?
-
是的,已经安装了
-
你能看看我下面粘贴的yml吗
标签: ruby-on-rails ruby postgresql