How to set redis DB ID in Docker container?

I have one data container and I would like to use several web_only containers (several forums on separate servers). How to I pass a DB ID to web_only container so that multiple forums use their own cache?

Without this the stats reported in Admin -> Reports are mixed up between different forums.

2 Me gusta

I’ve got the same issue. I have an existing redis cluster (with replication and failover) that I want Discourse to use, but I can’t find a way to tell Discourse which database index to use.

I’ve found the corresponding setting via this answer. It’s hidden in discourse_defaults.conf:

It’s called redis_db, so the corresponding setting in the container yaml should be DISCOURSE_REDIS_DB.

1 me gusta

Definitely do not do anything like this :fire: . Message Bus which is responsible for long polling relies on pub/sub, pub/sub is always on “db 0” not configurable.

If you try to co-host multiple Discourses on one Redis DB expect some very major amount of breakage.

6 Me gusta

Thank you for the warning! :bowing_man:

2 Me gusta

@sam, ¿sigue siendo preciso tu aviso :fire: de 2018 sobre el bus de mensajes vinculado exclusivamente a Redis db 0, o ahora podemos usar un ID de base de datos de una instancia de Redis diferente para alojar diferentes instancias de Discourse?

Noté en la guía multisite-configuration-with-docker que se define un db_id: 2. Pensé que podría referirse al ID de la base de datos de Redis, de ahí esta pregunta :face_with_monocle:

         secondsite:
           adapter: postgresql
           database: b_discourse
           pool: 25
           timeout: 5000
           db_id: 2
           host_names:
             - b.discourse.example.com

Sí, esto sigue siendo 100% correcto, por lo que sé. PUB/SUB en Redis está vinculado a la base de datos 0. Discourse multisite está diseñado para funcionar correctamente con múltiples instancias que se comunican con un solo Redis usando la base de datos 0.

Pub/Sub no tiene relación con el espacio de claves. Se diseñó para no interferir con él en ningún nivel, incluidos los números de base de datos.

Publicar en la base de datos 10 será escuchado por un suscriptor en la base de datos 1.

2 Me gusta