如何访问oplog MongoDB(MMS副本集) [英] How to access to oplog MongoDB (MMS replica set)

查看:126
本文介绍了如何访问oplog MongoDB(MMS副本集)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个设置为 MMS 的MongoDB副本集.我创建了一个具有所有特权的用户(所有特权都在MMS上可用),但是我无法访问本地数据库和/或oplog合集.跟踪:

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 }

我需要将Meteor应用程序和另一个具有Node.js的应用程序连接到操作日志,但是我无法访问它.

I need connect my Meteor app and another apps with Node.js to the oplog but I cannot access it.

为什么? 因为我正在使用Node.js处理脚本以基于oplog创建队列.这是有可能的,我已经在MongoHQ和MongoLab上成功进行了测试,但是现在我需要在MMS的MMS生产副本集中使用MMS运行它,而无需创建自定义的MongoDB副本集.

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.

推荐答案

检查基本上,从mongo 2.6开始,您需要创建一个用户并授予对oplog的访问权限(以及使用正确的凭据访问数据库)

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)

类似的东西:

db.runCommand({ createRole: "oplogger", 
               privileges: [{ resource: { db: 'local', collection: 'oplog.rs'},
                               actions: ['find']}, ],
               roles: [{role: 'read', db: 'local'}] })

完整过程此处

这篇关于如何访问oplog MongoDB(MMS副本集)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆