Chapter 3 Setting Up a Sharded Cluster Cannot connect with 26000

In this lecture, I cannot connect with port 26000 in the last step,

I use mongo --port 26000 -u “m103-admin” -p “m103-pass” --authenticationDatabase “admin”,

the feedback is 2018-10-30T20:50:33.240+0000 E QUERY [thread1] Error: Authentication failed. :
DB.prototype._authOrThrow@src/mongo/shell/db.js:1608:20

Well, the error message is pretty clear, no? It’s saying the username or password are wrong.

Did you actually:

  • create a mongod instance on port 26000
  • that has authentication/authorization enabled
  • that has an m103-admin user
  • whose password is m103-pass

And did you restart MongoDB afterwards so the settings would actually be live? You could also probably connect using the “–host” param as well, specifying hostname etc.

You do not create a mongod instance on port 26000. The instructions indicate to start a mongos and the configuration file is also presented.

The instructions also indicate that mongos will inherit the user m103-admin from the m103-csrs replica set. So I will make sure I can connect to the m103-csrs cluster with the m103-admin user. If this does not work it means the m103-admin user has not been created yet or badly created (password or roles).

1 Like