Share MongoDB With separate Rocket Chat Servers

Description

Hi! For sake of learning, I want to deploy two separate Rocket Chat instances, serving two distinct audiences (two tenants: I want them isolated). Considering Rocket Chat does not support multi tenancy, I need to deploy two separate Rocket Chat Servers, each serving a different audience. My question is: It’s necessary to have separate MongoDB instances or can I share the MongoDB instances and use separate databases for each Rocket Chat server?

Answering my own question (Home someone can validate / correct my conclusion).

It’s not possible to share mongoDB instances with two separate tenants because Rocket Chat uses Meteor Oplog tailing and mongodb oplog is global and not per database.

@ralg Welcome :wave:

You are right with the OPLOG being global across all databases inside the database management system Mongo, but this is not a reason not to utilize two databases inside the same Mongo DBMS: The OPLOG is a mechanism of the DBMS to balance to balance load and be resilient, but it does not break DB isolation.

You just have to provide two different MONGO_URL environmen variables to the two Rocket.Chat node services on start.

Cheers, Oliver

Hi @ojaegle :wave: ! Thank you for your answer.

If meteor reads oplog to deliver realtime updates across multiple hosts (to avoid the overhead of poll-and-diff) and oplog is global, how does meteor filter oplog entries per Rocket Chat cluster? :thinking:

Thank you!