deploying redis to heroku unable to connect

前端 未结 3 1049
别跟我提以往
别跟我提以往 2020-12-25 15:12

ive been trying to get resque to work with heroku. i can successfully get it to work in development mode, however when i try pushing to heroku i get

Errno::E         


        
相关标签:
3条回答
  • 2020-12-25 15:33

    i fixed it. i can't believe it! my complete solution is

    uri = URI.parse(ENV["REDISTOGO_URL"])
    REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
    Resque.redis = REDIS
    

    verbatim. it works without explicitly setting the url because i guess heroku tries to set it up for me already

    0 讨论(0)
  • 2020-12-25 15:41

    I got the same thing, so, basically Sidekiq was not grabbing the REDISCLOUD_URL from vars, it was grabbing REDIS_PROVIDER.

    heroku config:set REDIS_PROVIDER=REDISCLOUD_URL
    

    It worked like a charm.

    0 讨论(0)
  • 2020-12-25 15:50

    For my setup I have /config/initializers/redis.rb with these lines:

    uri = URI.parse(ENV["REDISTOGO_URL"] || "redis://localhost:6379/" )
    REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
    

    My REDISTOGO_URL is defined in my heroku configuration. You should be able to validate that by typing:

    heroku config --app my_app
    

    You'll see in the output the value for REDISTOGO_URL

    You should copy your REDISTOGO_URL directly from Redis To Go. You find it in by going to the instance in heroku and clicking on Add Ons -> Redis To Go.

    Here are a couple pointers:

    1. Verify you have your REDIS_TO_GO URL in your heroku config from the command line like I've demonstrated above.
    2. Verify the REDIS_TO_GO URL is identical to the one assigned to that instance in the Add Ons -> Redis To Go config.
    0 讨论(0)
提交回复
热议问题