0

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.

soBusted
  • 197
  • 3
  • 18

2 Answers2

0

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

for_stack
  • 21,012
  • 4
  • 35
  • 48
  • Thank you for the reference and for explaining . it was helpful. Cheers! – soBusted Sep 05 '16 at 09:22
  • ElasticCache isn't Redis cluster mode. It is a "Redis compatible" service offering by Amazon. The fact that keys are returned tells you it is supported by ElasticCache, but yes it is a terrible idea to run keys j production. – The Real Bill Sep 05 '16 at 13:49
  • @TheRealBill Thanks for pointing it out! I'm not familiar with ElasticCache. I thought it refuses the `KEYS` command for cluster mode, and returns some customized information. – for_stack Sep 05 '16 at 15:42
0

I would recommend confirming the configuration of the app to ensure it is pointing to the ElasticCache setup. Redis cluster and ElasticCache are different things. As such whether it supports the keys command or not is irrelevant. If ElasticCache didn't support the keys command, as a Redis compatible server it would return an error, not an incomplete list of keys.

If there is expiration set on your keys it is possible you did not see them because at that moment they are expired. But it is also possible it is talking to a different server or even simply swallowing errors. We have no way of m owing that.

You can, however, use the info command and its sub-commands such as info commandstats to ensure commands are indeed running on it. If you do not see the commands listed that your app uses, your app isn't talking to it.

The Real Bill
  • 14,884
  • 8
  • 37
  • 39