Is there a way to disable command 'keys *' in Redis? - redis

I'm using AWS elastic cache Redis.
I saw that Warning: consider KEYS as a command that should only be used in production environments with extreme care in Redis Documentation.
If I want to disable the 'key' command, Is there a way to disable command 'keys' or 'keys *' in Redis ?
Thanks

Solution
You can disable the 'keys' command using the rename-commands in the parameter group(AWS elastic cache Parameter group).

Related

Disable Lua debugger in Redis

I would like to ensure that clients cannot use Redis' Lua debugger.
I already have ACLs set to prevent use of SCRIPT and EVAL commands.
I see on https://redis.io/topics/ldb that remote debugging mode can be entered using a CLI flag. Is this also prevented by ACLs, or is there some other method to be aware of?
I do not use LDB at all, so disabling it at build time would be great, if possible.
Redis Lua debugger is a remote debugger, and it needs Redis server and client to work together.
You can disable the SCRIPT command, either by rename-command configuration or ACL. Although the client can enter the debugging mode, Redis server will refuse SCRIPT DEBUG subcommand, and the remote debugging won't work.
I do not use LDB at all, so disabling it at build time would be great, if possible.
You cannot disable it at build time, unless you modify the source code to remove the feature, and rebuild it.

Reset REDIS db through CLI?

I am in the process of adding REDIS as a distributed cache to my application. When I run automated integration tests, I would like have each test start with a clean instance - so, create the DB if it does not exist, or clear it if it does.
When I do this for my Oracle instance, I just drop the configured user and recreate it, resulting in a clean slate. What would the REDIS equivalent be? The only way I have found to create DBs is to use the Web UI.
I believe you can do this, but (for obvious reasons) I have no intention to try it!
redis-cli flushall
Documentation here.

Flush caches after renaming Kubernetes provider account

I renamed the default my-kubernetes-account Kubernetes provider credential name by GCP Spinnaker deployment and now I ended up with having both on my spinnaker UI.
I tried to clear my browser's local storage or even remove it from application -> config -> Application Attributes -> Accounts, but none of them helped.
Is there any way to re-index providers or remove it in some way?
Update:
Would it help to remove all the related keys in redis, like:
redis-cli KEYS "*my-kubernetes-account:*" | xargs redis-cli DEL
Or is it a tottaly bad idea? :)
Yes, flushing the redis db is the correct way to remove the duplicate entries.
Any of the cached infrastructure details that you remove from redis will be automatically recreated by the caching agents.
Thanks,
-Matt

How can I find the last access time of a redis key?

In redis, two of the eviction policies, allkeys-lru and volatile-lru, evict keys based on access time. So, this information must exist somewhere. Is it possible for me to query the access time of a key? Or, better yet, page through a sorted list of keys based on access time?
Look at Object IDLETIME it gives time for which the object was idle
as guided by #Itamar Haber the way they disable some command is by using redis.conf
# It is also possible to completely kill a command by renaming it into
# an empty string:
#
rename-command FLUSHDB ""
rename-command FLUSHALL ""
rename-command DEBUG ""
As you are using Redis as a service on Heroku you have to have admin rights to do this
Hope this helps!

Redis clears data itself..!

I am using Redis since last 12 months without any issue, But from last 30 days unknowingly the database getting empty and we couldn't find any logs regarding this. Even it is flushing all the data out randomly after restoration.
We tried following steps to resolve this but result was zero.
We have checked redis logs
Monitored the redis using MONITOR command
We are trying to renaming the critical commands through config but redis is dump after the config change below is example command
rename-command FLUSHDB e0cc96ad2eab73c2c347011806a76b73
We gone made without knowing anything. Helps are appreciated.
Redis Version : 2.8.17
Running under Debian Linux
Renaming the command through config file will work in this case.
Same rename command you have to place inside the config file.
rename-command FLUSHDB e0cc96ad2eab73c2c347011806a76b73