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 „Gefällt mir“

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 „Gefällt mir“

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 „Gefällt mir“

Thank you for the warning! :bowing_man:

2 „Gefällt mir“

@sam, ist deine Warnung :fire: von 2018 bezüglich der Message Bus, die ausschließlich mit Redis db 0 verknüpft ist, noch gültig, oder können wir jetzt eine andere Redis-Instanz mit einer anderen Datenbank-ID verwenden, um verschiedene Discourse-Instanzen zu hosten?

Ich habe in der multisite-configuration-with-docker-Anleitung gesehen, dass dort db_id: 2 definiert ist. Ich dachte, das könnte sich auf die Redis-Datenbank-ID beziehen, daher diese Frage :face_with_monocle:

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

[quote=“sam, post:4, topic:56267, full:true”]
Mach definitiv nichts Ähnliches :fire:. Der Message Bus, der für Long Polling verantwortlich ist, nutzt Pub/Sub. Pub/Sub läuft immer auf „db 0

Ja, das ist nach meinem Kenntnisstand nach wie zu zu 100 % korrekt. PUB/SUB in Redis ist an DB 0 gebunden. Discourse Multisite ist so konzipiert, dass es problemlos mit mehreren Instanzen funktioniert, die mit einem einzigen Redis-Server über DB 0 kommunizieren.

Pub/Sub hat keinen Bezug zum Key-Space. Es wurde so entwickelt, dass es den Key-Space auf keiner Ebene beeinträchtigt, einschließlich der Datenbanknummern.

Das Veröffentlichen auf DB 10 wird auch von einem Abonnenten auf DB 1 empfangen.

2 „Gefällt mir“