Skip to content

Cluster client support for redis transactions #2384

Closed Answered by leibale
kamkash asked this question in Q&A
Discussion options

You must be logged in to vote

Redis (the server) does not support cross-slot commands in the same transaction (even if the slots are currently in the same shard/node). If you want to make sure that a couple of keys are in the same slot, you can use "hash tags"

// this will throw `CROSSSLOT` error
cluster.multi()
  .set('11')
  .set('12')
  .exec();

// this will work
cluster.multi()
  .set('{1}1')
  .set('{1}2')
  .exec();

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@kamkash
Comment options

@chayim
Comment options

@kamkash
Comment options

Answer selected by kamkash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants