Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I used redis for the first time to cache a computationally-expensive fragment. It works great. To further my learning, I'd like to query redis to examine what's it's storing, the expiry, any metadata it captures, and simply to learn how to use redis.

How can query redis on heroku?

What I tried

I tried shelling into the dyno with heroku ps:exec

Then tried using the redis-cli

redis
# -bash: redis: command not found
redis-cli
#-bash: redis-cli: command not found

Based on this I tried looking in a handful of places:

ls /bin | grep redis
ls /usr/local/bin | grep redis
ls /sbin | grep redis

but didn't find anything.

I noted I can get the REDIS_URL (and REDIS_TLS_URL) config variables like so

heroku config | grep REDIS
REDIS_TLS_URL:  rediss://:asdfasdfasdf@ec2-12-345-67-890.compute-1.amazonaws.com:31840
REDIS_URL:      redis://:asdfasdfasdf@ec2-12-345-67-890.compute-1.amazonaws.com:31839

but I'm not sure if I can shell directly into these or query them from my terminal somehow?

Worth noting that if you have a lot of keys, running KEYS * will block Redis for the duration of the run. Well, it does that even if you only have a few, but you'll care more if you have a lot of them. ;) Check out the SCAN command if this matters to you. – Guy Royse Mar 2 at 14:37

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.