2016-09-26 53 views
1

Replicaset - 蒙戈版本3.2.4,我使用bash脚本来更新在某些情况下蒙戈许可,是这样的:MongoDB - grantRolesToUser被回滚?

mongo <<EOF 
    db["grantRolesToUser"]("someone", ["readWriteAnyDatabase"]); 
    print(JSON.stringify(db.getUsers())); 
EOF 

基本上,增加readWriteAnyDatabase作用,以“人”。

它起作用,并且打印显示用户具有新角色。 但是,2-3秒后。它消失了 !!

有什么想法可能会导致此?

+0

日志中的任何线索? –

+0

问题是MMS/Ops Manager,如果您不是从Ops Manager更新角色,它将被回滚。 –

回答

0

此问题与跨越复制套件的用户的MMS/OpsManager自动同步有关。

从OpsManager手册:

If you want Ops Manager to ensure that all deployments in a group have the same database users, use only the Ops Manager interface to manage users. 

If you want certain deployments in a group to possess users not set at the group level, you can add them through direct connection to the MongoDB instances. 

所以,你可以在OpsManager或蒙戈或者控制用户shell本身,而不是两个。