未经授权(回复:{"注意":"未授权命令:启用数据库管理员和#34;" ok":0.0," errmsg" :"未授权"})

时间:2014-08-11 10:26:11

标签: c# mongodb

我在服务器上部署了mongodb的分片群集。并通过提供keyFile启用身份验证。在启用身份验证之前,我已通过分配密码和角色添加了用户。之后,我通过应用密钥文件重新启动了所有集群。

但是当我的应用程序尝试使用admin数据库执行enableharding(使用mongodb c#driver)时,我收到错误消息: "Command 'enablesharding' failed: unauthorized (response: {"note":"not authorized for command: enablesharding on database admin","ok":0.0,"errmsg":"unauthorized"}) "

我给用户的角色是:"角色" :[" readWriteAnyDatabase"," userAdminAnyDatabase"," readAnyDatabase"," dbAdminAnyDatabase"," dbOwner",&#34 ; clusterAdmin"," clusterManager"," clusterMonitor"," hostManager"," backup"," restore" ]

你能否就此提出一些解决方案。

感谢。

0 个答案:

没有答案