本文介绍了mongodb备份角色-mongodump的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个开发团队,该团队将定期从DEV中取出mongodump,然后将其还原到其本地主机上进行工作.我们最近在mongodb中实现了身份验证,我希望能够允许我们的开发团队仅在一个数据库上进行mongodump,以便他们可以将其还原到本地主机.

We have a development team that will periodically take a mongodump out of DEV and then restore it back to their local host for work. We have recently implemented authentication in mongodb and i would like to be able to allow our development team do a mongodump on one DB only so they can restore it to their local host.

我有一个角色继承了Admin的备份角色,但这是供我们的DBA备份整个系统.

I have a role that inherits the backup role from Admin, but that is for our DBA to backup the whole system.

我的问题是,我如何允许特定用户(让他们称其为"webdev")为特定的数据库(让其称其为产品")使用该备份角色?

My question, how do I allow for this backup role to be used by a specific user (lets call them "webdev") for a specific DB (lets call it "products")?

推荐答案

您可以在products数据库中创建具有读取权限的用户:

You can create an user in the products database with read permissions:

> use products
> db.createUser(  {
 user: "webdev",
 pwd: "password",
 roles: [ "read" ]
 } )

只记得用--excludeCollectionsWithPrefix=system

mongodump --excludeCollectionsWithPrefix=system

为了避免权限错误(假设您使用的是Mongo 3)

In order to avoid permission errors (assuming you are using Mongo 3)

这篇关于mongodb备份角色-mongodump的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 07:43