resty-redis-cluster icon indicating copy to clipboard operation
resty-redis-cluster copied to clipboard

how to get all keys

Open firstgitaccount opened this issue 4 years ago • 1 comments

I want to query all the keys in the redis cluster, redis:scan (0, 'match', '*', 100) , but only the data of one node is found. How can I find the keys of all nodes?

firstgitaccount avatar Nov 08 '20 12:11 firstgitaccount

It isn't supported on it's current state. The only commands that are supported to run on all nodes are flushdb and flushall: https://github.com/steve0511/resty-redis-cluster/blob/8fdcfb1e1318c17aed99ff139faa8649c4254512/lib/resty/rediscluster.lua#L50-L54

I think you can add KEYS to that list and it work work, note though that it would not use the SCAN method. Harder to implement.

Hope this answers your question

toredash avatar Nov 21 '20 09:11 toredash