简体   繁体   中英

(Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)):

I deploy small rails app on heroku with one CRUD.

heroku config --app painting-art

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] 

I am getting error like below

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>

help me to solve this error. thank you

您必须先在heroku配置 Redis服务器 ,然后才能对其进行配置和连接

It seems like you are using redis service in your application and it is trying to connect to a local(127.0.0.1) machine on port(6379) which it is unable to.

Solution 1:

As mentioned in the post that you are basically performing simple crud and does not need redis service(assumption), then comment out the redis_url mentioned in the config or wherever it is mentioned.

Solution 2:

Add redis as an add-on heroku and use the URL provided by heroku in the application. Another way would be using redis-service from redis labs( https://app.redislabs.com ) and using this url in your application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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