Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Redis clusters and transactions

While using Redis cluster I get the following error:

Cannot use 'MULTI' with redis-cluster.

With the just the following call:

Redis::multi();

Is there a way to ensure data integrity across the clusters without the use of transactions, since that is not possible

like image 912
Jorge Y. C. Rodriguez Avatar asked Feb 14 '26 03:02

Jorge Y. C. Rodriguez


1 Answers

Redis doesn't support transaction, if keys are located on different slots/nodes.

If you have to store your data in a cluster, you must ensure all keys related to your transaction are stored on a single slot. You can use hash tag to do that.

Then you can take the node holding the slot as a single Redis instance, and run transaction on that node.

like image 127
for_stack Avatar answered Feb 15 '26 16:02

for_stack



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!