How to access keys inside my Redis cloud database? - redis

I've created a Redis database on the Redis cloud with AWS. Till now I've added 5 hashes(key-value pairs) to the database but I can't seem to find a way to view those hashes. Can anyone tell me how to do that?

You should be able to connect using the command line redis-cli and the host, port and password for your Redis instance, then use the command hgetall <keyname> to see the contents of the hash stored at <keyname>.
Alternatively, download a copy of the graphical RedisInsight tool, and connect that to the host, port and password you're running Redis on.

Related

How can we restrict user to allow execution of specific command in Redis in redis-cli

Hi I am using Redis on RHEL 7, and want that users having access to redis-cli can only able to execute few specific commands not all the commands in Redis.
Here my purpose is that users having access to redis-cli can only perform some monitoring related commands e.g. cluster nodes , info not other keys read write commands to protect data.
As per Redis documentation it's not clear how to provide authorization bases access to user on commands.
Or is there any other way to deal with this?

How to delete all keys from redis cluster

I want to delete all keys from redis cluster by using fast process. I know how to delete the keys by using "redis-cli FLUSHALL". But this command can be slow when the data set is large. I heard that all keys can be cleared from redis cache by re-starting the redis service. I am testing this process on my local mac laptop. I am performing following steps:-
Setting many number of keys on my local redis server by using example command redis-cli SET mykey1 "Hello"
Then Re-starting the redis service "brew services restart redis" in the hope that all keys will be deleted when the service will be back up
Then getting the keys by giving "redis-cli KEYS '*'" command
I still see the keys after step-3
The keys are gone only when I give this command--> redis-cli FLUSHALL? How I can clear the keys by re-starting the redis service locally on my mac laptop first then I will try on QA servers?
You see the keys after restart because there is either RDB or AOF persistence enabled. See https://redis.io/topics/persistence.
RDB is enabled by default. To disable persistence, you need to edit your redis.conf or start as redis-server --save "" --appendonly no
See Is there a way to flushall on a cluster so all keys from master and slaves are deleted from the db on how to use redis-cli to send the command to all cluster nodes.
As dizzyf indicates, use FLUSHALL ASYNC to have the deletion performed in the background. This will create fresh hash maps for each database, while the old ones are deleted (memory reclaimed) progressively by a background thread.
In redis 4.0 and greater, the FLUSHALL ASYNC command was introduced, as a way to delete all the keys in a non-blocking manner. Would this solve your issue?
https://redis.io/commands/flushall
Thank you for links. These were very helpful. I was able to achieve the result by making changes to my redis.conf file with--> redis-server --save "" and --appendonly no. So after these changes, when I now re-start redis service nothing is saved.

Redis Cluster or Replication without proxy

Is it possible to build one master (port 6378) + two slave (read only port: 6379, 6380) "cluster" on one machine and increase the performances (especially reading) and do not use any proxy? Can the site or code connect to master instance and read data from read-only nodes? Or if I use 3 instances of Redis I have to use proxy anyway?
Edit: Seems like slave nodes don't have any data, they try to redirect to master instance, but it is not correct way, am I right?
Definitely. You can code the paths in your app so writes and reads go to different servers. Depending on the programming language that you're using and the Redis client, this may be easier or harder to achieve.
Edit: that said, I'm unsure how you're running a cluster with a single master - the minimum should be 3.
You need to send a READONLY command after connecting to the slave before you could execute any read commands.
A READONLY command only affects during the current socket session which means you need this command for every TCP connection.

Connect with redis on another gear in openshift

I created 2 gears, php-5.4 and nodejs+redis.
How do I connect with Redis from my PHP gear? Where do I change the configuration?
I am using this redis cartridge:
https://github.com/smarterclayton/openshift-redis-cart
You need to create your nodejs + redis application as a scaled application, that way redis will be on it's own gear, then you can use the supplied connection credentials to connect to it from your php gear.

How to clean up redis hosted by cloudfoundry?

The redis cache offered by CloudFoundry has a small capacity, i.e. 16MB.
I know redis has a command "FLUSHALL" which is used to delete all the keys in the cache. How to do the same thing in cloudfoundry?
You can recreate and rebind the service as you wish unless you have any specific configuration that cannot be migrated. (I assume services provisioned by CF.com should be created as the same.)
Also sending FLUSHALL to the redis tunnel should be another option if you have vmc and caldecott gem installed as well as a redis execution locally. Would you mind if you can send the error why you cannot connect to it?