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

Chapter 1: The Mongod, Lab - Launching Mongod

Here are the steps I took:

Start mongod:

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

Add User:

vagrant@m103:~$ mongo admin --host localhost:30000 --eval 'db.createUser({ user: "m103-admin", pwd: "m103-pass", roles: [{role: "root", db: "admin"}]})'
MongoDB shell version v3.6.17
connecting to: mongodb://localhost:30000/admin?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("cb197cf8-5301-40b9-917f-f745b94cf285") }
MongoDB server version: 3.6.17
Successfully added user: {
        "user" : "m103-admin",
        "roles" : [
                {
                        "role" : "root",
                        "db" : "admin"
                }
        ]
}

Attempt to validate: (failed)

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.

Kill the mongod pid:

vagrant@m103:~$ ps -ef | grep mongod
vagrant   1939     1  0 04:52 ?        00:00:20 mongod --port 30000 --dbpath first_mongod --logpath first_mongod/mongod.log --fork
vagrant   2222  2038  0 05:31 pts/2    00:00:00 grep --color=auto mongod
vagrant@m103:~$ kill 1939
vagrant@m103:~$ ps -ef | grep mongod
vagrant   2224  2038  0 05:31 pts/2    00:00:00 grep --color=auto mongod
vagrant@m103:~$

Restart mongod:

vagrant@m103:~$ mongod --port 30000 --dbpath first_mongod --logpath first_mongod/mongod.log --fork

about to fork child process, waiting until server is ready for connections.
forked process: 2232
child process started successfully, parent exiting
vagrant@m103:~$

Attempt to validate again: (failed)

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.
vagrant@m103:~$

Login to Mongo shell and Show Users:

MongoDB Enterprise > show users
{
        "_id" : "test.m103-admin",
        "userId" : UUID("0fa62436-da35-4c15-8f10-af911e6f2e80"),
        "user" : "m103-admin",
        "db" : "test",
        "roles" : [
                {
                        "role" : "root",
                        "db" : "admin"
                }
        ]
}

Not sure where I’m going wrong. Does the port have to be 27000?

Any help is appreciated. Thanks

Update:
As i am reading other posts about this same problem, I’m gathering that this Chapter 1 lab doesn’t contain all the steps necessary to complete it? According to other posts, I’m supposed to read ahead in order to get the necessary information? Do I have that correct? I’m okay with that, I just want to know what the deal is. What do I need to do?

@wagner.don,

From the steps, I can see that you haven’t met any of the four requirements in this lab:

The deal is, requirements 3 and 4 are options that can be obtained from the mongod documentation. These two mongod options were not covered in prior lectures.

PS: It’s against forum guidelines to post potential answers to labs, so bear that in mind for next time.

1 Like

Hi @wagner.don,

I hope you found @007_jb’s response helpful. Please let us know if you still have any questions.

Thanks,
Shubham Ranjan
Curriculum Services Engineer