How to wipe Heroku Redis?

27,760

Solution 1

You can do this with redis-cli.

RedisToGo gives you a url in the form:

redis://redistogo:[email protected]:9402

So this command will empty your db:

redis-cli -h catfish.redistogo.com -p 9402 -a d20739cffb0c0a6fff719acc2728c236 flushall

Solution 2

You can install the heroku-redis-cli plugin

Installation

Requirements:

  • The heroku gem — gem install heroku

  • A local installation of redis (or at least the redis-cli utility) — apt-get install redis-server

To install:

  • heroku plugins:install https://github.com/rapportive-oss/heroku-redis-cli.git

Usage

  • heroku redis:info — get run-time statistics from your redis.

  • heroku redis:monitor — monitor commands being sent to your redis in real time.

  • heroku redis:cli — execute custom commands against redis.

Then you could simply do:

$ heroku redis:cli
$ flushall

Steps taken from readme file on the github repo: https://github.com/rapportive-oss/heroku-redis-cli

Solution 3

To wipe your redis on heroku there are a couple of ways. One of the simplest is probably connecting to the heroku console and clearing it from there. Commands are (for cedar stack):

heroku run console
REDIS.flushall

And that's it :-)

Solution 4

You can do this with the heroku console:

$ heroku redis:cli -a my_app --confirm my_app
$ FLUSHALL

Source: https://menubar.io/heroku-redis-flushall

Solution 5

You can destroy and recreate the entire Redis datastore for your app by doing:

heroku addons:remove redistogo
heroku addons:add redistogo
Share:
27,760
kidcapital
Author by

kidcapital

twitter.com/kidcapital

Updated on July 09, 2022

Comments

  • kidcapital
    kidcapital almost 2 years

    I have some information stored in my RedisToGo instance in Heroku and I want to wipe it so the Redis store is clean. Any idea how to do this?

  • kidcapital
    kidcapital over 12 years
    Is there a better way than dropping and re-adding the whole instance?
  • user7740901
    user7740901 over 12 years
    That's the easiest way. If you are using the environment variable then this should be a quick and easy change.
  • Neil Middleton
    Neil Middleton over 12 years
    It depends on what you're using to be honest, if it's something like Rails you can run it via the Rails console (heroku run console) - however, it's very dependant on what tools you're using.
  • esbanarango
    esbanarango about 10 years
    It is not an Heroku command but an heroku-redis-cli plugin command.
  • Lal Krishna
    Lal Krishna almost 10 years
    It hasn't been updated for over 2 years and doesn't work
  • Dom Barker
    Dom Barker over 9 years
    only if you are running a ruby app
  • Admin
    Admin about 9 years
    This gives me (error) NOAUTH Authentication required.. What is that about?
  • amlutz160
    amlutz160 over 8 years
    this was definitely an easier approach. worked for me.
  • ty.
    ty. over 8 years
    @torazaburo That error occurs when you've entered bad credentials.
  • Jesse Farmer
    Jesse Farmer over 5 years
    This no longer works. You get a NOAUTH error. There may be a missing step, but the steps above will just yield an error.
  • ty.
    ty. over 5 years
    @JesseFarmer I was just able to run this command successfully. Received "OK" response. You might want to double check your credentials.
  • AndreiMotinga
    AndreiMotinga over 5 years
    @ty, it responds with OK, but it seems like it doesn't actually clear it. So far I wasn't able to find a way to clear rediscloud redis without accessing rails console.
  • nmu
    nmu about 4 years
    @Keyul just tried it and it seems to still be working.
  • Radon Rosborough
    Radon Rosborough about 4 years
    The plugin fails to install.
  • Tallboy
    Tallboy about 2 years
    For anyone reading this answer, you can simply do redis-cli -u redis://... with the URL