Configuration Lab file - Issue

I have my mongod.cfg located in /etc and i can run mongod -f “/etc/mongod.cfg”
I start mongo --port 27000
then use admin
i try to recreate the users just to check if they exist (from lab1)
i just keep getting the below errors …
Below is the snippet of all the commands and the errros i get

MongoDB Enterprise > 'mongo admin --host localhost:27000 --eval ’
mongo admin --host localhost:27000 --eval
MongoDB Enterprise > db.createUser({
… user: “m103-admin”,
… pwd: “m103-pass”,
… roles: [
… {role: “root”, db: “admin”}
… ]
… })
'2019-10-21T06:31:09.354+0000 E QUERY [thread1] Error: couldn’t add user: there are no users authenticated :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1437:15
@(shell):1:1
MongoDB Enterprise > use admin
switched to db admin
MongoDB Enterprise > db.createUser({
… user: “m103-admin”,
… pwd: “m103-pass”,
… roles: [
… {role: “root”, db: “admin”}
… ]
… })
2019-10-21T06:31:36.738+0000 E QUERY [thread1] Error: couldn’t add user: there are no users authenticated :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1437:15
@(shell):1:1
MongoDB Enterprise > validate_lab_configuration_file
2019-10-21T06:32:04.654+0000 E QUERY [thread1] ReferenceError: validate_lab_configuration_file is not defined :
@(shell):1:1

Hi @Parsurama_Reddy_84828,

Please authenticate your user as below:

use admin
db.auth("m103-admin","m103-pass")

You need to run all the validation scripts outside of mongo shell and in the vagrant box.

Please let me know if you face any more issues.

Thanks,
Muskan
Curriculum Support Engineer

I get 1 , so it is authenticated ,

MongoDB Enterprise > use admin
switched to db admin
MongoDB Enterprise > db.auth(“m103-admin”,“m103-pass”)
1

And then i shutdown
MongoDB Enterprise > db.shutdownServer()
server should be down…
so i m backk to vagrant box,

and now i try to run as below

vagrant@m103:/$ validate_lab_configuration_file
Client experienced a timeout when connecting to the database - check that mongod is running on the correct port, and that your user was created with the correct settings.

Hi @Parsurama_Reddy_84828,

You don’t have to shutdown the server as this will close the mongo shell and will not let you validate the lab successfully.

Instead, you need to let this be up and running, open a second terminal, ssh into vagrant and then run the validation script.

Thanks,
Muskan
Curriculum Support Engineer

On 1 terminal, i ran mongod -f “/etc/mongod.cfg”
and thsi was fine
and then i ran , mongo --port 27000 and mongo shell was kicked in

Now in the second terminal , i did vagrant ssh and then trying to check
validate_lab_configuration_file

I get the same error again

vagrant@m103:/$ validate_lab_configuration_file
Client experienced a timeout when connecting to the database - check that mongod is running on the correct port, and that your user was created with the correct settings.

Not sure what is the issue !!

Hi @Parsurama_Reddy_84828,

Can you please share your config file and also check if you are using the correct port as mentioned in the lab notes.

Thanks,
Muskan
Curriculum Support Engineer

Here is the content of my config file

storage:
dbPath: “/data/db”
systemLog:
path: /data/log
destination: “file”
replication:
replSetName: M103
net:
bindIp : 127.0.0.1,192.168.103.100
port : 27000
processManagement:
fork : true
security:
authorization: enabled

I am not sure if there is something i am doing incorrect here !! Is it possible for you to call me on +46 733438107.

Hi @Parsurama_Reddy_84828,

I would suggest you to carefully follow the exact same instructions mentioned in the lab : Configuration File.

The parameters given below are not required for this one.
replication:
replSetName: M103

Thanks,
Muskan
Curriculum Support Engineer

1 Like

Thank you so much !! I just had to remove the repl set name and it is fixed now !!!

1 Like