Search code examples
amazon-web-servicesredisredis-cli

keys command behavior on redis vs redis cluster on aws


kinda newbie on redis...

I've noticed a weird behavior on redis.. When I'm running redis locally, & using the command 'keys *' - I get\see all of the keys in the system- which is alright and according to the documentation.

When I run redis in a Elasticache\cluster mode on aws & using the command 'keys *' - I only get '1) "ElastiCacheMasterReplicationTimestamp"' on all 3 reds servers. I've tried other commands to find the missing info, but to no avail. Our app\server seems to be operating normal so something is working properly, but what and where ? I have read the documentation but couldn't find anything on this.

Can anyone explain? Many thanks.


Solution

  • The KEYS command is NOT supported by Redis Cluster. You can only send KEYS command to a single Redis instance.

    It's NOT a good idea to use KEYS command in production environment, especially when you have too many keys in Redis (it's will block Redis for a long time).

    If you insist on getting all keys in your Redis Cluster, you have to implement it yourself, and there's an example