Client experienced a timeout when connecting to the database

vagrant@m103:~$ validate_lab_launch_mongod
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 @Amita_62847,

Please make sure that your mongod instance is running on port 27000 before you run the validator.

You can run this command to see the currently running mongod instances.

ps -ef | grep mongod

Hope it helps!

Thanks,
Shubham Ranjan
Curriculum Support Engineer

vagrant@m103:~$ mongod --port 27000 --dbpath /data/db --logpath /data/db/mongod.log --fork

about to fork child process, waiting until server is ready for connections.
forked process: 7167
child process started successfully, parent exiting
vagrant@m103:~$ validate_lab_launch_mongod
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 @Amita_62847,

Did you create the user by running this command ?

Thanks,
Shubham Ranjan
Curriculum Support Engineer

Please show the result of

In addition, show the last few lines of /data/db/mongod.log.

vagrant@m103:~$ validate_lab_launch_mongod
You need to bind the IP address to 127.0.0.1 or localhost.

vagrant@m103:~$ mongod --port 27000 --dbpath /data/db --logpath /data/db/mongod.log --fork

about to fork child process, waiting until server is ready for connections.
forked process: 7413
child process started successfully, parent exiting
vagrant@m103:~$ mongo admin --host localhost:27000 --eval ’ db.createUser({user:“m103-admin”,pwd:“m103-pass”,roles:[{role:“root”,db:“admin”}]})’

MongoDB shell version v3.6.16
connecting to: mongodb://localhost:27000/admin?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“8702fb25-12ad-48a6-be62-74da5719b71d”) }
MongoDB server version: 3.6.16
Successfully added user: {
“user” : “m103-admin”,
“roles” : [
{
“role” : “root”,
“db” : “admin”
}
]
}

vagrant@m103:~$ validate_lab_launch_mongod

You need to bind the IP address to 127.0.0.1 or localhost.

Hi @Amita_62847,

As I can see, you are missing one option in your mongod command i.e. --bind_ip

Please refer our documentation to learn more about how to bind the IPs.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

ip binding will be done at time of forking or creating the user

vagrant@m103:~$ mongo admin --host localhost:27000 --bind_ip 192.168.103.100 --eval ’ db.createUser({user:"m103-admin
",pwd:“m103-pass”,roles:[{role:“root”,db:“admin”}]})’

Error parsing command line: unrecognised option ‘–bind_ip’
try ‘mongo --help’ for more information

I am not getting the exact picture of this lab assignments process. which command should execute where and how?

Hi @Amita_62847,

I would suggest you to watch the video lecture (The Mongod) one more time to understand the difference between mongod and mongo command.

You don’t have to modify the mongo command.

Add the --bind_ip option in the mongod command that you are running. Just like some other command line option, --bind_ip will also take some value.

Read carefully what the instruction says in the documentation.

Hope it helps!

Thanks,
Shubham Ranjan
Curriculum Support Engineer

–bind_ip is not part of the mongo service it is part of --mongod service.

use --dbpath /data/db instead of data/db in mongd command.

Just this got resolved the timeout exception

Closing this thread as the issue has been resolved.