How to wipe Heroku Redis?

HerokuRedis

Heroku Problem Overview


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?

Heroku Solutions


Solution 1 - Heroku

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 - Heroku

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 - Heroku

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 - Heroku

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 - Heroku

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

heroku addons:remove redistogo
heroku addons:add redistogo

Solution 6 - Heroku

In order to empty the store, you can run the flushall command: http://redis.io/commands/flushall

So, simply something like:

$redis.flushall

if you're doing it with Ruby or similar.

Solution 7 - Heroku

Get a python shell on heroku by doing the following CLI:

heroku run python

Then in that shell type

import os
import redis
redis_url = os.getenv('REDISTOGO_URL', 'redis://localhost')
r = redis.from_url(redis_url) 
r.flushdb()

Solution 8 - Heroku

heroku run rails c

$redis.flushall

Solution 9 - Heroku

I'm using Ruby on Rails on Heroku and tried this, it worked (After heroku run rails console)

> $redis = Redis.new url: ENV['REDISCLOUD_URL']
> $redis.flushall
=> "OK"

Solution 10 - Heroku

You can use this https://github.com/rapportive-oss/heroku-redis-cli to connect to the Redis instance you are using, Heroku update broke it some time ago but there is a fix https://github.com/johnbeynon/heroku-redis-cli. Then just do flushdb

Solution 11 - Heroku

If you're looking for a one-liner (and happen to be using Rails), you can do

heroku run rails runner 'REDIS.flushall'

rather than connecting first (with console) then manually entering the flushall command.

Solution 12 - Heroku

This can be done in one convenient one-liner, even for non-ruby apps:

echo " FLUSHALL\r\n QUIT" | heroku redis:cli -a MY_APP --confirm MY_APP

Replace MY_APP with the name of your app.


Note: This assumes that you have Heroku CLI installed.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionkidcapitalView Question on Stackoverflow
Solution 1 - Herokuty.View Answer on Stackoverflow
Solution 2 - HerokuesbanarangoView Answer on Stackoverflow
Solution 3 - HerokuJason Robert GreenView Answer on Stackoverflow
Solution 4 - HerokunmuView Answer on Stackoverflow
Solution 5 - HerokuJames WardView Answer on Stackoverflow
Solution 6 - HerokuNeil MiddletonView Answer on Stackoverflow
Solution 7 - HerokuCullen Fluffy JenningsView Answer on Stackoverflow
Solution 8 - HerokujamesdlivesinatreeView Answer on Stackoverflow
Solution 9 - HerokukangkyuView Answer on Stackoverflow
Solution 10 - HerokuDmytro YashkirView Answer on Stackoverflow
Solution 11 - HerokuOllie BennettView Answer on Stackoverflow
Solution 12 - HerokuAndreasView Answer on Stackoverflow