I am facing these two errors Error: All keys in the pipeline should belong to the same slots allocation group and ReplyError: MOVED 15980 173.19.0.4:6391 while using ioredis with cluster mode, scaleReads set to all and enableAutoPipelining set to true
Error: All keys in the pipeline should belong to the same slots allocation group
at Pipeline.exec (/path/to/folder/node_modules/ioredis/built/Pipeline.js:272:29)
at Object.moved (/path/to/folder/node_modules/ioredis/built/Pipeline.js:145:31)
at EventEmitter.handleError (/path/to/folder/node_modules/ioredis/built/cluster/index.js:518:26)
at Pipeline.fillResult (/path/to/folder/node_modules/ioredis/built/Pipeline.js:138:25)
at /path/to/folder/node_modules/ioredis/built/Pipeline.js:186:18
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
ReplyError: MOVED 4657 173.19.0.2:6389
at new Promise (<anonymous>)
at executeWithAutoPipelining (/path/to/folder/node_modules/ioredis/built/autoPipelining.js:143:33)
at EventEmitter.set (/path/to/folder/ioredis/built/utils/Commander.js:95:63)
I tried these two workarounds which worked fine, but they are not wanted
- Use a separate
.pipeline() for all of our writes and left all reads on the auto pipeline -> everything worked well and without these two errors.
- Set
scaleReads to master -> everything worked well and without these two errors.
I am using:
- ioredis: 5.2.4
- node: v16.15.1
- npm: 9.2.0
- redis in cluster mode
- 3 masters
- 3 slaves (replicas)