# Support for Redis services without multiple logical databases

**URL:** <https://meta.discourse.org/t/support-for-redis-services-without-multiple-logical-databases/417599>\
**Category:** Development\
**Created:** [17 בנובמבר,‏ 2026,‏ 1:04am UTC](https://meta.discourse.org/t/support-for-redis-services-without-multiple-logical-databases/417599 "2026-11-17T01:04:12Z")\
**Posts on this page:** 1\
**Page:** 1

## סיכום מבוסס בינה מלאכותית

[tanya_byrne](/t/-/417599/1) reports a compatibility issue between self-hosted Discourse instances and Azure Managed Redis, which only supports logical database 0. Discourse currently forces Sidekiq to use a different logical database by automatically incrementing the configured Redis DB index (`db: config[:db].to_i + 1`), leading to a `Redis::CommandError: ERR DB index is out of range` when database 0 is set. She proposes two solutions to enhance flexibility while retaining default behavior: introducing a `DISCOURSE_SIDEKIQ_REDIS_DB` setting to manually configure Sidekiq's database index, or allowing Sidekiq to connect to a separate Redis instance using database 0. This change would facilitate the use of managed Redis services, such as the upcoming Azure Managed Redis (replacing the retiring Azure Cache for Redis), reducing the need to maintain separate VMs for isolation. tanya_byrne offers to contribute a PR if the proposed approaches align with project goals.

<div class="post-metadata">

**Author:** ![tanya\_byrne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tanya_byrne/32/444826_2.png) [@tanya\_byrne](https://meta.discourse.org/u/tanya_byrne)\
**Post date:** [17 בנובמבר,‏ 2026,‏ 1:04am UTC](https://meta.discourse.org/t/support-for-redis-services-without-multiple-logical-databases/417599/1 "2026-11-17T01:04:12Z")

</div>

Hi!

I’ve been looking into using Azure Managed Redis with a self-hosted Discourse installation and ran into a compatibility issue that I thought might be worth raising.

Azure Managed Redis only supports logical database 0, whereas Discourse currently uses a separate logical database for Sidekiq.

Looking through the Discourse code, I noticed that `sidekiq_redis_config` automatically increments the configured Redis database:

```plaintext
config.merge!(db: config[:db].to_i + 1)

```

This means that even with `DISCOURSE_REDIS_DB=0`, Sidekiq attempts to connect to database 1, resulting in:

```plaintext
Redis::CommandError: ERR DB index is out of range

```

I was wondering whether there would be any interest in making the Sidekiq Redis configuration a little more flexible, while retaining the existing behaviour by default.

A couple of possible approaches might be:

- **Configurable Sidekiq Redis database:** Introducing an optional setting such as `DISCOURSE_SIDEKIQ_REDIS_DB`, allowing the database index to be configured rather than automatically incremented.
- **Separate Redis connection for Sidekiq:** Allowing Sidekiq to connect to a different Redis instance using database 0. This would preserve isolation between Discourse and Sidekiq without requiring multiple logical databases.

We’re trying to reduce the amount of infrastructure we maintain ourselves, so using managed services for things like Redis is preferable to running and maintaining another VM. This is also becoming more relevant as Microsoft is retiring Azure Cache for Redis in favour of Azure Managed Redis, which doesn’t support multiple logical databases.

I appreciate that this isn’t necessarily the standard Discourse deployment model, and there may be good reasons for the existing configuration. However, I thought the compatibility issue was worth raising as it could affect other self-hosted installations using managed Redis services too.

I’d be interested to hear whether either approach would be appropriate, or if there’s an existing configuration option I’ve overlooked.

I’d also be happy to put together a PR if there’s interest in supporting this!

Thanks!
