Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis KEYS Method #30

Closed
woozyking opened this issue Mar 25, 2013 · 2 comments
Closed

Redis KEYS Method #30

woozyking opened this issue Mar 25, 2013 · 2 comments

Comments

@woozyking
Copy link

Hi,

When I call redis.keys("*") method, it would give me only the keys from one node from the cluster.

So I gave the map() method a try:

with redis.map() as c:
    r = [c.keys(*)]

Which still gives me the single node's values. Maybe I just used the map() wrong. Then I tried redis methods like info() and dbsize(), they all report back a list of values representing the whole cluster.

Please let me know if it's possible to achieve this.

Thanks in advance.

@dcramer
Copy link
Collaborator

dcramer commented Mar 25, 2013

There's no good way to do this at the moment. You'd have to call out to each individual connection or setup a custom router which understood the keys command and ran it on all nodes.

It's pretty awful but you can do this:

keys = []
for db in cluster:
  keys.extend(cluster[db].keys())

On Monday, March 25, 2013 at 3:03 PM, oEL wrote:

Hi,
When I call redis.keys("") method, it would give me only the keys from one node from the cluster.
So I gave the map() method a try:
with redis.map() as c: r = [c.keys(
)]

Which still gives me the single node's values. Maybe I just used the map() wrong. Then I tried redis methods like info() and dbsize(), they all report back a list of values representing the whole cluster.
Please let me know if it's possible to achieve this.
Thanks in advance.


Reply to this email directly or view it on GitHub (#30).

@woozyking
Copy link
Author

Thanks @dcramer, that's not so bad, given that my use case here is just to occasionally inspect the keys of all nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants