Authentication of Mongos

There are 9 mongo nodes in our environment with:

  • 1 mongos
  • 3 configuration servers (mongod --configSvr)
  • 9 mongod servers (fragments or members of sketched replica sets)

and we are trying to implement authentication on them.

I have done this in the past with a single server, and it was very simple:

  • just add admin user to admin database
  • add user to each database

I had to restart mongod with the --auth , but it does not work here.

I added an administrator account to our mongos and to our fined databases; I tried to authenticate as the user I just created, but that didn't work.

I tried to create the admin user in each database and the other user accounts that we need, but it still does not work.

I also tried to make sure that all of our mongo servers work with the --keyFile option specified either on the command line or in the /etc/mongodb.conf files, but this did not seem to help.

When I try to authenticate as the given user, for example:

 db.auth("user","passwd") 

it fails and returns 0 , as in false ; not non-zero .

I really need all the help I can get, so please at least leave some suggestions about what I could try - I cannot overestimate this, any help is more than welcome, as I seem to be going nowhere I won’t get away simply following the official documents on managing / administering clusters placed in the manga.

+8
authentication database mongodb nosql sharding
source share
1 answer

In a cluster cluster, you must use --keyFile so that all cluster members can authenticate with each other. When you use this option, --auth "assumed". Since there have been several changes in the version since you asked this question, the roles assigned to users are now more detailed - you will need to have "clusterAdmin", "userAdmin", "dbAdmin", etc.

This page contains more information on configuring security in MongoDB for a cluster cluster.

+1
source share

All Articles