Unable to "Validate_lab_launch_mongod"

I am running vagrant in windows 7 environment.
My command:
mongod --port 27000 --dbpath C:\Data\db --logpath C:\Data\log\mongod.log --bind_ip ‘127.0.0.1,192.168.103.100’ --auth
Here are my steps:
MongoDB Enterprise > 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 > exit
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 t
he correct settings.

Please check if user setup was done correctly or not
How did you connect to mongo
Is it created in correct db?
Are you able to connect to DB using the userid/pwd?

Checking the logs, now I see different error.

My command:
vagrant@m103:~$ mongod --port 27000 --dbpath C:\Data\db --logpath C:\Data\db\mongolab.log --bind_ip “127.0.0.1,192.168.103.100”

My config:
storage:
dbPath: C:\Data\db
journal:
enabled: true

systemLog:
destination: file
logAppend: true
path: C:\Data\log\mongod.log

net:
port: 27000
bindIp: 127.0.0.1

But in the log I see the below as its not taking the port 27000 and forcing 27017.

from log:
2019-05-19T08:34:24.635-0500 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory ‘C:/Data/db/diagnostic.data’
2019-05-19T08:34:24.893-0500 I NETWORK [initandlisten] waiting for connections on port 27017
2019-05-19T08:34:24.893-0500 I STORAGE [initandlisten] Service running

On Mongo:
vagrant@m103:~$ mongo --port 27000
MongoDB shell version v3.6.12
connecting to: mongodb://127.0.0.1:27000/?gssapiServiceName=mongodb
2019-05-19T14:12:20.522+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27000, in(checking socket for error after poll), reason: Connection r
efused
2019-05-19T14:12:20.523+0000 E QUERY [thread1] Error: couldn’t connect to server 127.0.0.1:27000, connection attempt failed :
connect@src/mongo/shell/mongo.js:263:13
@(connect):1:6
exception: connect failed

How do I start mongod with port 27000? I missed some details, as learned in windows cannot start with port other than 27017?

How to overcome this?

27017 is the default port

When you issue mongo it will connect to this port

When you started mongod with port 27000 did it really start?
Did you get any errors?
ps -ef|grep mongo
cleanup all mongods if any running by killall mongod

Try to start mongod on port 27000 with the command you used earlier

Appreciate your quick response!
No it didn’t, i get below error:
vagrant@m103:~$ mongod --port 27000 --dbpath C:\Data\db --logpath C:\Data\db\mongolab.log --bind_ip “localhost,192.168.103.100”
2019-05-19T15:05:23.713+0000 I CONTROL [main] log file “/home/vagrant/C:Datadbmongolab.log” exists; moved to “/home/vagrant/C:Datadbmongolab.log.2019
-05-19T15-05-23”.

Also I am using windows.
And after cleanup I get the same error as stated above. As this is window and the above log file doesn’t exists.

Waiting clueless as trying out many option didn’t work.

Please review all your steps
If you are using vagrant why you are using C:\Data… kind of paths?
You have to use unix directories /data,/shared,/var etc

Using windows to connect to virtual environment as the storage, install all in windows and the services use ubuntu.

I think we are deviating from the main issue. Why mongod not starting with all config, binaries and commands are inline? If i am missing some thing here then can the support person (Kanika_singla) be of help to resolve this.

Attention: Kanika Singla

I get this to partially working but not sure if I am in right path.

Summary:

  1. Mongod started on port 27017 with out setting dbpath, port, logpath - it worked and started,
    vagrant@m103:~$ mongod
    2019-05-19T16:06:50.543+0000 I CONTROL [initandlisten] MongoDB starting : pid=2229 port=27017 dbpath=/data/db 64-bit host=m103
    2019-05-19T16:06:50.545+0000 I CONTROL [initandlisten] db version v3.6.12

  2. Mongod didn’t start on port 27000 with all efforts and different options.

  3. Started mongo
    vagrant@m103:~$ mongo
    MongoDB shell version v3.6.12
    connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
    Implicit session: session { “id” : UUID(“ba757c27-6823-46e1-9d6a-67f1671f1ff1”) }
    MongoDB server version: 3.6.12
    Welcome to the MongoDB shell.

  4. Create user
    MongoDB Enterprise > mongo admin --host localhost:27000 --eval ’
    2019-05-19T16:08:42.306+0000 E QUERY [thread1] SyntaxError: missing ; before statement @(shell):1:6
    db.createUser({
    user: “m103-admin”,
    MongoDB Enterpris 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 > show dbs
    admin 0.000GB
    config 0.000GB
    local 0.000GB
    MongoDB Enterprise > use admin
    switched to db admin
    MongoDB Enterprise > show collections
    system.users
    system.version

  5. Validate user created:
    { “_id” : “test.m103-admin”, “user” : “m103-admin”, “db” : “test”, “credentials” : { “SCRAM-SHA-1” : { “iterationCount” : 10000, “salt” : “cpZ0i4WXhgw
    JkQeoFNq4jw==”, “storedKey” : “Q9lfk7qzQGJ2laeyuB+6m5/eeCI=”, “serverKey” : “LuSzZRQ+/oiAjktvyKzR3S9RbUE=” } }, “roles” : [ { “role” : “root”, “db” :
    “admin” } ] }

  6. Unable to validate as the mongod is running on port 27017.
    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 t
    he correct settings.

Conclusion:
Unless mongo university/support person helps, progress on this seems a show stopper without progress for Mongodb on windows.

From the user community: good that few of them are supporting others with the experience they have otherwise we cannot expect too much from them as its Mongo university responsibility to see that the course joined user community gets proper attention on support.

My case:
I enrolled in April 2019 and couldn’t get the VM and hyper threading enabled to get the mongo installed in Windows in a week time, so I discontinued.
Later I researched a lot and some how got this working.
Joined here now (May 2019)
Now I have a road block and couldn’t progress as my mongod doesn’t start on port 27000. Not sure if I can get help before Tuesday to complete this chapter and stay in course.

Hi Sankar_79615

I can understand the problems you are facing
Sure you can wait for the support from Course instructors

I am not deviating the topic.Just trying to help you
Please don’t get confused with default port 27017 and 27000
mongod can be started on default port without giving any options and connect to mongod just by typing mongo
Regarding Windows vs Unix once vagrant is setup all work is done on Unix box itself
In your config file you have mentioned dbpath as /data/db and log path as 'C:…"
which is incompatible

Unless your mongod is up and running you cannot connect to port 27000
You can start mongod on port 27000 within 5 mins by choosing proper dirs

Showing some exmples below:

vagrant@m103:~ mongod --fork --logpath /data/db/mongod.log about to fork child process, waiting until server is ready for connections. forked process: 3765 child process started successfully, parent exiting vagrant@m103:~ ps -ef|grep -i mongod
vagrant 3765 1 14 03:42 ? 00:00:02 mongod --fork --logpath /data/db/mongod.log
vagrant 3795 3702 0 03:42 pts/0 00:00:00 grep --color=auto -i mongod
vagrant@m103:~$ mongo
MongoDB shell version v3.6.9
connecting to: mongodb://127.0.0.1:27017
Implicit session: session { “id” : UUID(“220a13f1-0508-469b-b770-135ebd20fc99”) }
MongoDB server version: 3.6.9
Server has startup warnings:
2019-05-20T03:42:28.882+0000 I STORAGE [initandlisten]
2019-05-20T03:42:28.882+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine

MongoDB Enterprise > db
test
MongoDB Enterprise > show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
MongoDB Enterprise > exit
bye

2)Start mongod on port 27000
vagrant@m103:~$ cd /data/db

vagrant@m103:/data/db$ mongod --port 27000 --dbpath /data/db/test --logpath /data/db/test/mongodb.log --bind_ip 127.0.0.1,192.168.103.100 --fork
about to fork child process, waiting until server is ready for connections.
forked process: 3808
child process started successfully, parent exiting
vagrant@m103:/data/db$ ps -ef|grep -i mongo
vagrant 3765 1 1 03:42 ? 00:00:07 mongod --fork --logpath /data/db/mongod.log
vagrant 3808 1 18 03:49 ? 00:00:01 mongod --port 27000 --dbpath /data/db/test --logpath /data/db/test/mongodb.log --bind_ip 127.0.0.1,192.168.103.100 --fork
vagrant 3833 3702 0 03:49 pts/0 00:00:00 grep --color=auto -i mongo
vagrant@m103:/data/db$

You can see mongods running one on default port and second one on port 27000

vagrant@m103:/data/db$ mongo admin --host localhost:27000
MongoDB shell version v3.6.9
connecting to: mongodb://localhost:27000/admin
Implicit session: session { “id” : UUID(“2551314e-69a5-4e38-906c-61307e66fbc9”) }
MongoDB server version: 3.6.9
2019-05-20T03:49:24.314+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-05-20T03:49:24.314+0000 I CONTROL [initandlisten]
MongoDB Enterprise > db
admin
MongoDB Enterprise >

Hope it is clear
Also you are running eval command at mongo prompt.It will not work (you can see syntax error in your logs)
Run at os prompt

1 Like

Hi @Sankar_79615,

Firstly, kill all the mongod processes running by using the following command:

ps -ef | grep mongod

kill < pid > mongod

Then, follow the steps mentioned in the lab and ensure that you follow the exact same name and directory structure as mentioned in the lab. If you face any issue in launching mongod, you can check the error by removing --fork option.

Please use the correct command to connect to the mongo shell and then create the user exactly as mentioned in the lab. Please authenticate the user and check if the user has been created by using the following command:

use admin
db.getUsers()

When you have completed all the steps above, then validate the lab.

I hope it helps!!

Let me know, if you face any issue.

Thanks,
Sonali

@ [Ramachandra_37567]
Appreciate your efforts to put down the steps as it helped me as well others for sure.

After putting all efforts to make this work in Windows, couldn’t make it to work so switching to Ubuntu as I hate the copying, moving lines in & out.

Here I could progress and finally ran into bug I think so, unable to run validate_lab_launch_mongo. Does any one witness the same.

After starting the mongod on port 27000 and mongo too:

image

Your are welcome!

Please note the example i gave used a different directory (/data/db/test1)
You have to follow the lab instructions
Change your dbpath to /data/db (stop mongod,correct the path,start mongod)
Your validation should work

No luck, still the same.

Do you need the mongod running on port 27017 as well is my other thought?

No
27017 is not needed
After bringing up mongod on port 2700 did you create the user with proper roles
Validation script looks for this user

Yes

image

First time when you ran validate you passed dbpath
In second one i don’t see it
Please run validate script again with parameter /data/db