Erika
Erika

Reputation: 609

How Redis Sentinel work with Bull queue (using NestJS)

I am working on a NestJs project using Bull queue. Here is the code I am using to connect Redis, and it works well。

BullModule.registerQueueAsync(
      {
        name: 'test',
        imports: [ConfigModule],
        useFactory: async (configService: ConfigService) => ({
          redis: {
            host: configService.get('REDIS_ADDR'),
            port: configService.get('REDIS_PORT'),
          },
        }),
        inject: [ConfigService],
      }
)

Now, I need to switch to using Redis Sentinel. I searched online, but I could not find an appropriate tutorial.

I appreciate any help you can provide.

Upvotes: 3

Views: 922

Answers (1)

Erika
Erika

Reputation: 609

    BullModule.forRoot({
  redis: {
    sentinels: [
      {
        host: process.env.redis_senti,
        port: Number(process.env.redis_senti_port),
      },
    ],
    name: 'mymaster',
    password: redis_pass,
    sentinelPassword: redis_pass,
    maxRetriesPerRequest: 100,
  },
}),

Hi, I finally ended up with this configuration.

Upvotes: 1

Related Questions