Cluster identifier in MongoDB

Viewed 233

I would like to implement a licensing solution in my software which restricts/binds usage to one MongoDB cluster (the cluster size and composition does not matter - can be standalone as well). Is there any identifier provided by MongoDB which I could use for this purpose?

1 Answers

You're looking for access control settings on the cluster level. You can create sharded cluster users:

db.getSiblingDB.("clustername").createUser(
  {
    "user": "<name>",
    "pwd": "<password>",
    "roles": [ { "role" : "readWrite", "db" : "clustername" } ]
  }
)

and a detailed description can be found https://docs.mongodb.com/manual/tutorial/enforce-keyfile-access-control-in-existing-sharded-cluster-no-downtime/ under Configure Sharded Cluster Admin User and Client Users. If you ensure that each user of your application gets an username and password in mongodb (your software needs to take care of that), you can guarantee that they can only access this cluster.

Related