Reputation: 2720
I have a MongoDB replica set with MMS. I created a user with all privileges (all available on MMS) but I can't access to the local db and/or oplog colecction. TRACE:
mydatabse-r1:PRIMARY> use local
switched to db local
mydatabse-r1:PRIMARY> db.oplog.rs.find().pretty();
error: { "$err" : "not authorized for query on local.oplog.rs", "code" : 13 }
I need connect my Meteor app and another apps with Node.js to the oplog but I cannot access it.
Why? Because I'm working on a script with Node.js to create a queue based on the oplog. This is possible, I tested on MongoHQ and MongoLab successfully, but now I need run this in my MMS production replica set with MMS without create a custom MongoDB replica set.
Upvotes: 3
Views: 6096
Reputation: 21299
Check this link
Basically, from mongo 2.6 you need to create a user and grant access to the oplog (as well as accessing the DB using the right credentials)
Something like:
db.runCommand({ createRole: "oplogger",
privileges: [{ resource: { db: 'local', collection: 'oplog.rs'},
actions: ['find']}, ],
roles: [{role: 'read', db: 'local'}] })
Full procedure here
Upvotes: 4