MongoDB Atlas -管理员用户无权在shell中运行命令

iecba09b  于 2023-01-30  发布在  Go
关注(0)|答案(1)|浏览(223)

我在mongoDBMap集里设置了一个副本。
我可以使用mongosh连接到群集,但无法执行rs.status()甚至show users等命令。我收到以下错误:

Atlas atlas-lmkye1-shard-0 [primary] wtlive-staging> rs.status()
MongoServerError: not authorized on admin to execute command { replSetGetStatus: 1, lsid: { id: UUID("d888f98f-5b92-4fdf-836d-8c8ad86df659") }, $clusterTime: { clusterTime: Timestamp(1674659350, 1), signature: { hash: BinData(0, 611CAD1FEBDB879CD8C71265AF6CD769AFDC37DA), keyId: 7160608903690977282 } }, $db: "admin" }
Atlas atlas-lmkye1-shard-0 [primary] wtlive-staging> show dbs
admin           424.00 KiB
config          220.00 KiB
local            13.37 GiB
monstache       160.00 KiB
wtlve-staging   18.23 GiB
Atlas atlas-lmkye1-shard-0 [primary] wtlive-staging> show users
MongoServerError: not authorized on waiter-staging to execute command { usersInfo: 1, lsid: { id: UUID("d888f98f-5b92-4fdf-836d-8c8ad86df659") }, $clusterTime: { clusterTime: Timestamp(1674659934, 11), signature: { hash: BinData(0, 4BA4C6CC9223F392114A1148663017143E15D3CD), keyId: 7160608903690977282 } }, $db: "wtlive-staging" }
Atlas atlas-lmkye1-shard-0 [primary] wtlive-staging>

我的onpremise MondbDB没有这个问题。你知道是什么问题吗?

jvlzgdj9

jvlzgdj91#

仔细查看内置角色:读写任意数据库
操作replSetGetStatus需要群集管理器
操作usersInfo需要用户管理员

相关问题