0

have one problem with a replica set

There is an admin user with root permissions It's fully working on config servers, but when I trying to auth with it on any RS - got:

2017-09-18T09:01:53.755-0400 E QUERY    Error: 18 Authentication failed.
at DB._authOrThrow (src/mongo/shell/db.js:1271:32)
at (auth):6:8
at (auth):7:2 at src/mongo/shell/db.js:1271
exception: login failed

User was added on config servers, after all Replica Set was deployed, maybe that is the problem?

1 Answer 1

0

Yes. When you "try" to authenticate directly to any replica set at the cluster, "local" admin database is used (admin database at the replica set).

You need to create that admin user locally. IF there are NO users inserted to your RS's admin database, "localhost exception" is still valid and you should not have any problem login without authentication (no -u and -p parameters on mongo -command) and create that admin user. After first user is created to RS, localhost exception is gone and you need authenticate. So, first created user MUST be admin with root rights.

2
  • Thanks. But that isn't first admin user. There are main admin user with root access (that was created at the cluster deploying moment), and a new one, that was created in config DB during work. Main admin user isn't available. In that case - the only one possible solution - is to down all replicas except primary, run in maintenance mode w/o auth, and create a user? Or there is some simpler way to do it?
    – Duiz
    Commented Sep 18, 2017 at 19:43
  • Yes. If that user what is already created to RS, doesn't have right to create other users, you must start your RS on maintenance mode and create that missing admin user.
    – JJussi
    Commented Sep 19, 2017 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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