redis / ioredis

🚀 A robust, performance-focused, and full-featured Redis client for Node.js.
MIT License
14.31k stars 1.19k forks source link

"Error: All keys in the pipeline should belong to the same slots allocation group" while using ioredis with cluster mode and scaleReads set to "all" #1806

Open jishidaaaaa opened 1 year ago

jishidaaaaa commented 1 year ago

Please advise on how to handle the following error: https://github.com/redis/ioredis/issues/1734. Similarly.

I am using ioredis in cluster mode with scaleReads set to all and enableAutoPipelining set to true. I have three questions.

Firstly, should I not set scaleReads to all when enableAutoPipelining is enabled?

Secondly, in issue https://github.com/redis/ioredis/issues/1734, it is suggested as a workaround to disable enableAutoPipelining and manage separate pipelines for read and write operations. However, I am unsure how to replace my current enableAutoPipelining setting with this approach. Since I don't know when the pipeline's exec command is executed when enableAutoPipelining is enabled, it is unclear if separating the read and write pipelines would maintain equivalent performance. How should I configure it to achieve similar performance during the transition?

Lastly, if there is any other recommended approach, please let me know.

I am using:

redis in cluster mode