Use Transactions and Pipelines in Cluster Mode
mainMost features like multi and pipeline work in Cluster mode, but with specific constraints:
- Pipelines: All keys in a single pipeline must belong to the same slot (and thus the same node), as ioredis sends the entire pipeline to one node.
- Transactions (
multi): You cannot usemultiwithout a pipeline. Usecluster.multi({ pipeline: false })if needed, but note that ioredis won't know which node to send themulticommand to unless it's part of a pipeline context. - Automatic Resending: If a pipeline receives a
MOVEDorASKerror, ioredis will automatically resend the entire pipeline to the new node only if:- All errors in the pipeline are identical (e.g., all point to the same new node).
- All successfully executed commands in that pipeline were read-only.
If these conditions aren't met, the pipeline will fail to prevent side effects.