Mongo --port 27012 -u "m103-admin" -p "m103-pass" --authenticationDatabase "admin" MongoDB shell version v3.6.12

hello

can anyone help?
mongo --port 27012 -u “m103-admin” -p “m103-pass” --authenticationDatabase “admin”
MongoDB shell version v3.6.12
connecting to: mongodb://127.0.0.1:27012/?authSource=admin&gssapiServiceName=mongodb
2019-04-29T11:22:45.406+0000 E QUERY [thread1] Error: Authentication failed. :
connect@src/mongo/shell/mongo.js:263:13
@(connect):1:6
exception: connect failed

Please make sure m103-admin user is created in the mongo db.

thank.
can you explain how can i check that?

you won’t be able to login if m103-admin is not created. please create m103-admin user as outlined in the course.

1 Like

Thanks, it works.
my second problem is that i cant shutdown the db, maybe it because i connected to Primary node.
MongoDB Enterprise m103-repl:PRIMARY> db.shutdownServer()
2019-04-29T12:15:12.046+0000 E QUERY [thread1] Error: shutdownServer failed: {
“ok” : 0,
“errmsg” : “No electable secondaries caught up as of 2019-04-29T12:15:12.045+0000Please use the replSetStepDown command with the argument {force: true} to force node to step down.”,
“code” : 50,
“codeName” : “ExceededTimeLimit”
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.shutdownServer@src/mongo/shell/db.js:453:1
@(shell):1:1

Its not because of Primary. Secondaries are not sync with Primary.

Hi @Tal_38236,

Your command looks fine but please make sure to check for the following things:

  1. You should be able to use db.shutdownServer() while connected to the primary node but ensure that the current database is admin.

  2. Also make sure that all your secondary nodes are working when you are trying to shutdown the primary node. You can check the details of the replica set member using the rs.status() command.

Please refer to the docs below for more information:

If you are still facing the same issue, please let me know.

Thanks,
Sonali