I have a mongodb cluster with one replSet, 3 config servers, and 2 mongos instances. I logged into mongos using (admin, pwd). admin is given ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"]. It works well. but when I logged into the replSet directly. I cannot pass authentication using (admin, pwd) again. I found that mongodb culster, replset, config servers, and mogos all have admin databases. They are different. What are the difference? what are the differences when doing authentication?

Can I create a (admin, pwd) in the admin database of the replSet? Will I have trouble when I add new replSet?

Thanks, Best,


When I created admin users against mongos, I also created admin users for replication Set. Now I can administrate shards, config server, and mongos now.

Different shards can have different users in their admin databases. If keyfile is uique, new shard (running with auth and keyfile enabled) can be added to the running cluster.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.