简体   繁体   English

Heroku redis/sidekiq 连接超时-用户指定的超时错误

[英]Heroku redis/sidekiq Connection timed out - user specified timeout error

This is an issue that happened after upgrading my Redis instance version on Heroku using heroku redis:upgrade The error happened when Sidekiq tried to connect to Redis:这是在使用 heroku升级我的 Redis 实例版本后发生的问题heroku redis:upgrade当 Sidekiq 尝试连接到 Redis 时发生错误:

Connection timed out - user specified timeout

After reading this guide: https://github.com/mperham/sidekiq/wiki/Using-Redis#life-in-the-cloud I thought the problem might be in the.network connection, so I tried increasing the.network timeout in config/initializers/sidekiq.rb like this: config.redis = {.network_timeout: 5 }阅读本指南后: https://github.com/mperham/sidekiq/wiki/Using-Redis#life-in-the-cloud我认为问题可能出在 .network 连接上,所以我尝试增加 .network 超时在config/initializers/sidekiq.rb像这样: config.redis = {.network_timeout: 5 }

Unfortunately this did not help, it only increased the time that it takes to create the connection, but the same error was still occurring in the end.不幸的是,这并没有帮助,它只是增加了创建连接所需的时间,但最终仍然出现同样的错误。

I noticed that after upgrading the Redis instance version, Heroku had not updated the REDIS_URL config var to match the new redis url. So, the URL in the config var:我注意到在升级 Redis 实例版本后,Heroku 没有更新REDIS_URL配置变量以匹配新的 redis url。因此,配置变量中的 URL:

heroku config:get REDIS_URL

was different from the one returned by:与返回的不同:

heroku redis:credentials

So my solution was as per the following guide: https://devcenter.heroku.com/articles/managing-heroku-redis-using-cli#redis-credentials to reset Redis the credentials:所以我的解决方案是按照以下指南: https://devcenter.heroku.com/articles/managing-heroku-redis-using-cli#redis-credentials重置 Redis 凭据:

heroku redis:credentials --reset

With this command, new credentials are created for the Redis instance and the related config vars on the Heroku application are automatically updated.使用此命令,将为 Redis 实例创建新凭据,并自动更新 Heroku 应用程序上的相关配置变量。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM