I've setup a replicat set mongoDB in mongoDB Atlas.
I can connect to the cluster woth mongosh
but can't execute command like rs.status()
or even show users
.
I'm getting the below error:
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>
With my onpremise MondbDB i don't have this issue. Any idea of what could be the matter?
CodePudding user response:
Have a careful look at Built-In Roles: readWriteAnyDatabase
Action replSetGetStatus
requires clusterManager
Action usersInfo
requires userAdmin