(在localhost上连接到Redis时出错:6379(Errno :: ECONNREFUSED)):

问题描述 投票:0回答:2

我使用一个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>

帮我解决这个错误。谢谢

ruby-on-rails heroku
2个回答
0
投票

0
投票

您似乎在应用程序中使用redis服务,并且它尝试连接到端口(6379)上的本地(127.0.0.1)计算机,但它无法连接。

解决方案1:

正如帖子中提到的那样,你基本上执行简单的crud并且不需要redis服务(假设),然后注释掉配置中提到的redis_url或者提到的地方。

解决方案2:

将redis添加为附加组件heroku,并在应用程序中使用heroku提供的URL。另一种方法是使用redis labs(https://app.redislabs.com)的redis-service并在你的应用程序中使用这个url。

© www.soinside.com 2019 - 2024. All rights reserved.