redis / redis-py

Redis Python client
MIT License
12.55k stars 2.51k forks source link

Can not get all keys in redis cluster #2498

Closed nmtruong93 closed 1 year ago

nmtruong93 commented 1 year ago

Version: 4.4.0

Platform: Python 3.8.10 on Mac M1 Montery 12.6

Description: I tried 2 Redis client packages: redis 4.4.0 and redis-py-cluster 2.1.3

Please help me solve this problem. Thank you.

dvora-h commented 1 year ago

@nmtruong93 Are all the 71 keys you get with redis-py-cluster in the same node? If not - this is the expected behavior of the keys command, to return the keys from the node you sent the command to.if you want to get the keys from all the nodes you can specify the target_nodes to primaries or all: connection.keys('pfs:aiml:*:status', target_nodes="primaries")

nmtruong93 commented 1 year ago

@dvora-h thanks, you solved my problem!