Elasticache cluster "CROSSLOT keys in request don't hash to same slot "
chandank-nu opened this issue · comments
Hi, I'm backend developer.
Reason
Multi-Key operation is limited in cluster mode
- KEYS, SCAN
- Pipeline || Multi (with multiple single command)
- DEL, UNLINK
- HMGET, HMSET
You're using MULTI
operation with multiple s keys commands.
Redis cluster (Elasticache same) has 'slot' of the keys.
So If you try to multi-key based operation using 'Multi'
It's possible of 'CROSSSLOT' issue.
Because redis specific node (member of cluster) don't have all slots you input the keys (keyv:faqc:...
, ['namespace:keyv']
)
Solution
I have an idea application-level approach.
- Group by slot - keys
- Delegates each command to specific master node which has 'slot'
You can refer to my article
how to resolve 'CROSS-SLOT' issue in redis cluster environment
There's example code I write.
This is not Apollo Graphql issue.
It's about redis cluster mode.