MongoDB – Hosting Multiple Databases on One Instance or Cluster

mongodb

In MongoDB there are the following conecpts:

A MongoDB database exists as a logical unit on a MongoDB Instance which is either a singleton or a cluster running within some number of mongod processes on some number of servers.

There is lots of Q&A around answering the question: Should one run multiple production mongod processes on the same server? to which the answer is: In general no.

However, what about the question of having multiple production databases on the same instance? I.e.:

  1. Set up a production grade mongodb cluster,
  2. Create a number of databases by doing something like
use someDatabase; 
db.someDatabase.insert({});

3.Creating a User/Role that is limited in access to someDatabase

The above described configuration could obviously suffer from the noisy neighbor problem (& related DoS attacks), but otherwise is the above considered a normal and standard way of providing a logical & security barrier between tenants? What are the pros/cons of doing so? If I needed to migrate one of these logical DBs to its own MongoDB instance, would that be possible?

Best Answer

Q1. what about the question of having multiple production databases on the same instance?

A: It is very normal to have multiple databases on same instance.

Q2. Creating a User/Role that is limited in access to someDatabase the above considered a normal and standard way of providing a logical & security barrier between tenants?

A: Database level authorization, works very effectively for limiting the user access rights on databases, it is safe to use.

Q3. If I needed to migrate one of these logical DBs to its own MongoDB instance, would that be possible?

A. You cannot have two databases with same name on same instance or cluster.

(If more details required, do ask)