I am working with a mongo cluster with 3 shards. Each shard replica-set in turn has 3 members. Security is enabled and I created users with clusteradmin, useradmin etc. roles, also many users whose access confined to particular databases. But now I have a problem when I am trying to collect storage engine (wired tiger in our case) stats. For that I need to directly connect to individual mongodb node in each replica-set and issue db.serverStatus() command. But, authentication is failing with all the users with clusteradmin, useradmin etc. privileges. How can I directly connect and authenticate (bypassing mongos) to a mongod node in the cluster and collect stats.
Asked
Active
Viewed 88 times
1 Answers
1
You can connect to individual instance with regular mongo
command, e.g.
mongo mongodb://host_name:port/db_name --authenticationDatabase admin --username ... --password ...
Tested with dbAdmin role, db.serverStatus()
works fine. clusterAdmin
and userAdmin
roles are not quite suitable for the job.

Alex Blex
- 34,704
- 7
- 48
- 75
-
Thanks. I think we have to add shard local user on each mongod instance. – Nipun Talukdar Dec 07 '17 at 12:12