#3 in final exercise will not validate

Here’s the issue.

storage:
  dbPath: /var/mongodb/1/db
net:
  bindIp: localhost
  port: 27006
systemLog:
  destination: file
  path: /var/mongodb/1/logs/mongod.log
  logAppend: true
processManagement:
  fork: true
replication:
  replSetName: m150-bigbank
security:
  keyFile: /var/mongodb/pki/node1/keyfile

Having activated the replica set, now…

m150-bigbank:PRIMARY> use admin
switched to db admin
m150-bigbank:PRIMARY> db.createUser(
...    {
...      user: "globalAdminUser",
...      pwd: "5xd49$4%0bef#6c&b*d",
...      roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
...    }
... );
Successfully added user: {
        "user" : "globalAdminUser",
        "roles" : [
                {
                        "role" : "userAdminAnyDatabase",
                        "db" : "admin"
                }
        ]
}
m150-bigbank:PRIMARY> db.createUser(
...    {
...      user: "clusterAdminUser",
...      pwd: "6@09%aef&5d41!d37",
...      roles: [ { role: "clusterAdmin", db: "admin" } ]
...    }
... );
uncaught exception: Error: couldn't add user: command createUser requires authentication :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1386:11
@(shell):1:1
m150-bigbank:PRIMARY> db.getUsers();
uncaught exception: Error: command usersInfo requires authentication :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.getUsers@src/mongo/shell/db.js:1659:15
@(shell):1:1
m150-bigbank:PRIMARY> db.auth("globalUserAdmin");
Enter password: 
Error: Authentication failed.
0
m150-bigbank:PRIMARY> db.auth("globalUserAdmin");
Enter password: 
Error: Authentication failed.
0
m150-bigbank:PRIMARY>

which you created is not the same as

which you use to authenticate

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.