Heroku: No Redis instances found - heroku

I want to change the maxmemory settings of Redis for my Heroku app, following these instructions.
Unfortunately, when I do heroku redis:maxmemory angelfish-9042 --policy volatile-lru, I get the following response in the terminal:
No Redis instances found.
I have the Redis addon running and the Redis plugin installed.
Any idea how to change the maxmemory settings? (I hit the limit allowed)

Related

Heroku CLI gives "No Redis instances found" yet I have a redis cloud addon running and usable

I'm learning redis and have it working from a java app. I'm trying to use the heroku redis:cli -a myAppName command to connect with it directly but it says "No Redis instances found".
When I do heroku apps it lists myAppName so I know it's valid.
heroku redis:info -a myAppName doesn't return anything.
The heroku docs don't seem to be accurate as they all leave out the -a flag which the cli tells me is required. Outside of that I don't know what I've missed.
You are looking at documentation for Heroku Redis, a hosted Redis service that Heroku itself provides. If you wish to use Heroku Redis, you can provision it for your app using like so:
heroku addons:create heroku-redis:hobby-dev -a your-app-name
Pricing for Heroku Redis can be found here. The Hobby Dev plan used in the previous command is free.
There are also other Redis providers that can be provisioned this way, including Redis Enterprise Cloud. Or you can use existing hosted Redis server. But with these options you won't be able to interact with the service using heroku redis commands. Use whatever tooling those providers offer.

Redis on heroku without RedisToGo add-on

Can we use redis on heroku for background jobs with python without using RedisToGo add-on. Any pointer please.
I've this error while following this https://devcenter.heroku.com/articles/python-rq post without using RedisToGo add-on
app[worker.1]: Error 111 connecting to localhost:6379. Connection refused.
Heroku does not include a redis server by default. You will have to use a Heroku add-on or connect to another instance you control.

BROKER_URL in Redis Cloud in Heroku

Im working with Redis on Heroku, Im trying RedisToGo and Redis Cloud, I need to get the URL of the DB to put it in BROKER_URL in the settings of my django app. RedisToGo gives me clearly the URL in the dashboard, but Redis Cloud does not. Somebody knows how to get it?
When you add the addon, the REDISCLOUD_URL gets set in the config variables. You should use the environment accessors in your app to use the URL, e.g. in Python os.environ.get('REDISCLOUD_URL') and in Ruby ENV['REDISCLOUD_URL'].
If you just want to know what the URL is, you can see it on the "Settings" tab on Heroku Dashboard--click "Reveal Config Vars." Or you can use the CLI:
heroku config:get REDISCLOUD_URL -a YourAppName

Redis not able to connect using redis-rb (with Redistogo URL)

I've created a Redis To Go Nano plan on Heroku and I'm using the connection URL in different
Heroku applications to share a rate-limit counter. Following all usual steps this is what I did.
I've added the add-on and I got back the REDISTOGO_URL.
# redis url
redis://user:pass#spadefish.redistogo.com:9014/
This is the raised error.
RuntimeError: nodename nor servname provided, or not known
I tried to simulate the connection from command line.
store = Redis.connect(url: 'redis://user:pass#spadefish.redistogo.com:9014/')
store.get('key') # raises error
And I get that error. If I use the local Redis instance everything works just fine.
store = Redis.connect(url: 'redis://localhost:6379/0')
store('key') # does not raise error
Everything makes me think it's a problem related to the Redis URL.
Am I missing something?
This was an issue that occurred with the redis to go spadefish server.
A CNAME was not initially configured for spadefish so you were getting a DNS resolution error.
The CNAME for spadefish has been added and you should not have a problem connecting to your instance.

How to use your own mysql database server with heroku?

I want to use mysql database which is hosted on my own server.
I've changed DATABASE_URL and SHARED_DATABASE_URL config vars to point to my server, but it's still trying to connect to heroku's amazonaws servers. How do I fix that?
According to the Heroku documentation, changing DATABASE_URL is the correct way to go.
If you would like to have your rails application connect to a non-Heroku provided database, you can take advantage of this same mechanism. Simply set your DATABASE_URL config var to point to any cloud-accessible database, and Heroku will automatically create your database.yml file to point to your chosen server. The Amazon RDS Add-on does this for you automatically, though you can also use this same method to connect to non-RDS databases as well.
Here's an example that should work:
heroku config:add DATABASE_URL=mysql://user:password#host/db
You may need to redeploy by making a change and running git push heroku master
By the way, the host is XXXX.amazonaws.com, where XXX is a long host hame that probably changes. If you can add a wildcard, that's the easiest %.amazonaws.com
I had this exact same problem with my Dreamhost MySQL database. Turns out the solution was to tell Dreamhost is was Ok to accept connections from this foreign host. Otherwise, Dreamhost blocks all requests to MySQL that don't originate from their systems.
It seems that if Heroku is falling back to Amazon AWS despite your DATABASE_URL, it's because it's being denied access to your MySQL database.

Resources