Chapter 1: The Mongod Lab - Launching Mongod and Configuration File

Hi,

Getting below error:

vagrant@m103:~ vagrant@m103:~ mongod --config m103.conf
2019-08-22T01:23:03.344+0000 I CONTROL [main] log file “/home/vagrant/first_mongod/mongod.log” exists; moved to “/home/vagrant/first_mongod/mongod.log.2019-08-22T01-23-03”.
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.

=============
Lab 1:

vagrant@m103:~$ mongod --port 27000 --dbpath first_mongod --logpath first_mongod/mongod.log --fork
about to fork child process, waiting until server is ready for connections.
forked process: 8619
child process started successfully, parent exiting

vagrant@m103:~$ mongo --port 27000
MongoDB shell version v3.6.14
connecting to: mongodb://127.0.0.1:27000/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“6c94333c-ea81-4d68-9345-473970b023ac”) }
MongoDB server version: 3.6.14

MongoDB Enterprise > show dbs
admin 0.000GB
config 0.000GB
local 0.000GB

MongoDB Enterprise > mongo admin --host localhost:27000 --eval ’
db.MongoDB Enterpri db.createUser({
… user: “m103-admin”,
… pwd: “m103-pass”,
… roles: [
… {role: “root”, db: “admin”}
… ]
… })
Successfully added user: {
“user” : “m103-admin”,
“roles” : [
{
“role” : “root”,
“db” : “admin”
}
]
}

MongoDB Enterprise > validate_lab_launch_mongod
2019-08-22T01:05:45.130+0000 E QUERY [thread1] ReferenceError: validate_lab_launch_mongod is not defined :
@(shell):1:1

Appreciate any help.

Thanks

Looks like your user is not created
Run the command at os prompt.You ran it at mongo prompt
Also validate script should be run at os prompt

Thanks for reply.
I have verified that user is created.
I could see user with “_id” : “test.m103-admin” under admin > system.user by running below command:

db.system.user.find().pretty()
Thanks

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.

Getting this error for both the labs…

Thanks

Are you able to login to DB using the new user you created?
Please check your steps again
How did you connect to mongo when creating the user
I see it is created in test db
Please check our forum.You will get help
validation script will fail if you don’t follow the lab requirements

2 Likes

Yes, you were correct…it was created in test db…
“_id” : “test.m103-admin”,
“user” : “m103-admin”,
“db” : “test”

I got my error: I was adding wrong IP(didnt read lab properly)…after ping m103…rechecked lab and corrected it…

Tests are now cleared.

Many thanks for help :slight_smile: