简体   繁体   English

Active Record 无法在 5.000 秒内获得数据库连接

[英]Active Record Could not obtain a database connection within 5.000 seconds

From the last few weeks, I am seeing this error "Could not obtain a database connection within 5.000 seconds."从过去几周开始,我看到此错误“无法在 5.000 秒内获得数据库连接”。 I have tried the following solutions.我尝试了以下解决方案。

As per Sidekiq Docs I have reduced the concurrency to 10 and increased MySql DB pool size to 12. But I was still getting this error so I increased the DB pool size to 27. But still, the issue is there.根据 Sidekiq Docs,我已将并发性降低到 10,并将 MySql 数据库池大小增加到 12。但我仍然收到此错误,因此我将数据库池大小增加到 27。但问题仍然存在。 Tried solutions from this and this answer.这个这个答案中尝试了解决方案。 My Sidekiq server machine doesn't have any other process running which can consume AR connections.我的 Sidekiq 服务器机器没有运行任何其他可以使用 AR 连接的进程。 I am not spinning any threads from outside.我没有从外面纺任何线。 Below are the configurations I have下面是我的配置

Sidekiq version - 3.4.2
Rails version - 4.2.4
Active Record version - 4.2.4
Database pool size - 27
Sidekiq concurrency - 10

Any help with this will be appreciated.对此的任何帮助将不胜感激。

I suspect it to be a connection leak from the server side.我怀疑这是服务器端的连接泄漏。

Sidekiq::Middleware::Server::ActiveRecord is the middleware that is responsible for returning connections to the pool, after a job is completed. Sidekiq::Middleware::Server::ActiveRecord是负责在作业完成后将连接返回到池的中间件。 This should be included by default.默认情况下应包含此内容。

When you start your server with -v flag,当您使用-v标志启动服务器时,

bundle exec sidekiq -v -C config_file

it will print all the middlewares that will be invoked.它将打印将被调用的所有中间件。 Can you check if this middleware is present in the list?你能检查一下这个中间件是否存在于列表中吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ActiveRecord :: ConnectionTimeoutError:无法在5.000秒内获取数据库连接(等待5.000秒) - ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 seconds (waited 5.000 seconds) Sidekiq在AWS RDS上返回“ ActiveRecord :: ConnectionTimeoutError:无法在5.000秒(等待的5.000秒)内获得数据库连接” - Sidekiq returns “ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 seconds (waited 5.000 seconds)” on AWS RDS ActiveRecord :: ConnectionTimeoutError(无法在5.000秒(等待的5.000秒)内获得数据库连接) - ActiveRecord::ConnectionTimeoutError (could not obtain a database connection within 5.000 seconds (waited 5.000 seconds)) 活动记录数据库组织 - Active Record database Organization 无法建立与数据库的连接 - Connection to database could not be established 获取与数据库的当前活动连接 - Get current active connection to the database 活动记录(轨道)MySQL安全连接 - Active Record (Rails) MySQL Secure Connection 插入记录 10 秒后从数据库中删除记录 - DELETE Record from database after 10 seconds of insertion of record 无法创建与数据库的连接(ColdFusion) - Could not create connection to database (ColdFusion) 使用Active Record区分大小写的数据库搜索 - Case-sensitive database search with Active Record
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM