[英]Rails - Redis::CannotConnectError: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)
[英](Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)):
我用一個CRUD在heroku上部署了小型Rails應用程序。
heroku config --app繪畫藝術
This is the legacy Heroku CLI. Please install the new CLI from https://cli.heroku.com
=== painting-art Config Vars
DATABASE_URL: [postgres]
LANG: en_US.UTF-8
RACK_ENV: production
RAILS_ENV: production
RAILS_LOG_TO_STDOUT: enabled
RAILS_SERVE_STATIC_FILES: enabled
SECRET_KEY_BASE: [SECRET_KEY_BASE]
我收到如下錯誤
2018-05-29T07:21:12.395658+00:00 app[web.1]: I, [2018-05-29T07:21:12.395584 #4] INFO -- : [070ffe50-8753-4e61-8fe3-1273de66a29e] Completed 500 Internal Server Error in 12ms (ActiveRecord: 3.4ms)
2018-05-29T07:21:12.396947+00:00 app[web.1]: F, [2018-05-29T07:21:12.396874 #4] FATAL -- : [070ffe50-8753-4e61-8fe3-1273de66a29e]
2018-05-29T07:21:12.397040+00:00 app[web.1]: F, [2018-05-29T07:21:12.396976 #4] FATAL -- : [070ffe50-8753-4e61-8fe3-1273de66a29e] ActionView::Template::Error (Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)):
2018-05-29T07:21:12.397328+00:00 app[web.1]: F, [2018-05-29T07:21:12.397247 #4] FATAL -- : [070ffe50-8753-4e61-8fe3-1273de66a29e] 18: <tr>
幫助我解決此錯誤。 謝謝
似乎您在應用程序中使用Redis服務,並且它試圖連接到端口(6379)上無法連接的本地(127.0.0.1)計算機。
解決方案1:
正如文章中提到的那樣,您基本上是在執行簡單的任務,不需要redis服務(假設),然后注釋掉配置中提到的redis_url或任何提及的地方。
解決方案2:
將redis添加為附加的heroku,並使用heroku在應用程序中提供的URL。 另一種方法是使用來自redis labs( https://app.redislabs.com )的redis-service並在應用程序中使用此URL。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.