3

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.

Stennie
  • 63,885
  • 14
  • 149
  • 175
skozz
  • 2,662
  • 3
  • 26
  • 37

1 Answers1

4

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

AdrieanKhisbe
  • 3,899
  • 8
  • 37
  • 45
Flavien Volken
  • 19,196
  • 12
  • 100
  • 133