How can I remotely check data in my RedisCloud DBs?

I am using Heroku to host a simple Ruby on Rails application to learn how to use Redis. I am using RedisCloud as my Redis service provider. Locally, I can check my Redis DBs using the Redis CLI, but how can I check the data in the RedisCloud DB that the Heroku app uses?

RedisCloud provides a dashboard that shows statistics, but not actual data. Also, I tried using Redis Desktop Manager , but it has too many errors for me to remotely connect to my RedisCloud DB.

+3


source to share


2 answers


Step by step:

1 - Check your Heroku config to find out the REDIS URL.

heroku config

      

You should see an input that looks like this:



REDISCLOUD_URL:              redis://rediscloud:foobarfoobarfoobar@a-redis-address:18888

      

2 - Connect to a remote Redis DB with redis-cli

:

redis-cli -h a-redis-address -p 18888 -a foobarfoobarfoobar

      

Now you can query your Redis DB.

+10


source


Since you are using Rails, you can also connect to the Rails console like this:

$ heroku run console

      

Once connected, you will get an initialized redis connection based on your configuration (like you have $redis = Redis.new(url: ENV["REDISCLOUD_URL"])

in config/initializers/redis.rb

):



irb(main):001:0> $redis
=> #<Redis client v3.2.1 for redis://domain.com/0>

      

Alternatively, you can create a new one:

irb(main):002:0> $redis2 = Redis.new(url: 'redis://domain.com')
irb(main):003:0> $redis2
=> #<Redis client v3.2.1 for redis://domain.com/0>

      

+1


source







All Articles