0

I have created MongoDB deployment (replica set) using MMS Portal. I have enabled authentication in MMS portal, so that DB can be only accessed by providing credentials.

In MMS portal I don't find any option to assign oplog permission to user.

So, how can I create User with OpLog permission?

Background

Before posting this question I have searched for for the same, and found following link.

How to access to oplog MongoDB (MMS replica set)

Solution in above link is to create roles. But am not sure about this approach because, in MMS portal I can see many build-in roles but in admin database there is no system.roles collection!

INFO MongoDB version is 3.0.3

4

1 回答 1

1

Here is how I added user with oplog access for MongoDB Replication set deployed via MMS.

In MMS Portal

  1. Click Deployment -> MongoDB Users menu.
  2. Click ADD USERS button.
  3. In the form type database as admin, type preferred username & password, in roles enter root@admin (You can choose other roles as well which has create users privilege)

Now we have to login via mongo console.

mongo <domain.name>:<port>/admin -u <just_created_user> -p

Once inside mongo console type following command to create user with access to oplog

db.createUser({user: "oplogUser", pwd: "PASSWORD", roles: [{role: "read", db: "local"}]})

Now we can access oplog using following URL

mongodb://oplogUser:PASSWORD@<domain.name>:<port>/local?authSource=admin
于 2015-06-08T16:39:27.740 回答