medusa
medusa copied to clipboard
RedisOptions don't use redis sentinel endpoints and configuration
Bug report
Describe the bug
I used Redis sentinel configuration in medusa-config.js as you stated that redisoptions from ioredis package are used:
/** @type {import('@medusajs/medusa').ConfigModule} */
module.exports = {
projectConfig,
plugins,
modules,
redis_options: {
connectionName: process.env.REDIS_CONNECTION_NAME || "medusa",
sentinels: [
{
host: process.env.REDIS_SENTINEL_URL,
port: process.env.REDIS_SENTINEL_PORT || "26379",
},
],
name: process.env.REDIS_SENTINEL_MASTERSET || "mymaster",
db: process.env.REDIS_DATABASE_INDEX || "5"
},
featureFlags: {
product_categories: false
}
};
but it seems that Medusajs backend is always using redis_url. It reports errors as not being able to use read-only replicas.
ReplyError: READONLY You can't write against a read only replica.
at parseError (/app/node_modules/redis-parser/lib/parser.js:179:12)
at parseType (/app/node_modules/redis-parser/lib/parser.js:302:14)
ReplyError: READONLY You can't write against a read only replica.
at parseError (/app/node_modules/redis-parser/lib/parser.js:179:12)
at parseType (/app/node_modules/redis-parser/lib/parser.js:302:14)
ReplyError: READONLY You can't write against a read only replica. script: 04bc84f52b5c1a1238af36a0c38c474721088663, on @user_script:164.
at parseError (/app/node_modules/redis-parser/lib/parser.js:179:12)
at parseType (/app/node_modules/redis-parser/lib/parser.js:302:14) {
I would like to use Redis with sentinel configuration since we are using that on our Kubernetes cluster. We had to deploy a single master Redis additionally to be used just by Medusajs backend.
System information
Medusa version (including plugins): 1.20.2 Node.js version: 18 Database: postgres 16 Operating system: Linux - Kubernetes cluster
Steps to reproduce the behavior
Add redis sentinel configuration to medusa-config.js
Expected behavior
Use HA redis with sentinel instead single redis master instance