Lab-Launching Mongod

Do we need to create a storage /data/db/ or already existed?
Even though i killed specific mongod instance…it’s still exists if i check with
ps -ef | grep mongod command…
First we have to create a user and then run mongod instance or viceversa?

1 Like

i think it is default path
However you can check if it exists or not
cd /data/db or ls -lrt /data/db

You can kill mongod with kill -9 PID (pid of mongod process)
or killall mongod

start mongod
connect to mongo
create user

if you are using default, you can stop mongod using mongo --shutdown from another terminal window.

while validating it ask me following path… You need to specify db path /data/db. where i need to mention?

while validating it ask me following path… You need to specify db path /data/db. where i need to mention?

hi DHANESH_S_GUNDLA_43602

How did you start mongod?
Your lab instructions would have asked you to use particular dir for dbpath
Please follow those steps

If you don’t use the specified values validation scripts will fail

Hello , I have tried to xonnect to mondod but have been getting the error below . Any clue?

vagrant@m103:~ mongod --dbpath /data/db --logpath ~/data/logs --replSet M103 --bind_ip '127.0.0.1,192.168.0.100' --keyFile /data/keyfile --fork about to fork child process, waiting until server is ready for connections. forked process: 11145 ERROR: child process failed, exited with error number 1 To see additional information in this output, start without the "--fork" option. vagrant@m103:~ mongod --port 27000 --dbpath /data/db --logpath ~/data/logs --replSet M103 --bind_ip ‘127.0.0.1,192.168.
0.100’ --keyFile /data/keyfile --fork
about to fork child process, waiting until server is ready for connections.
forked process: 11148
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the “–fork” option.

Please try to run without --fork option
It will throw error on your terminal on why it is failing
Most likely some dir path or log path not existing or permissions issues or unable to access keyfile

oh ok . thanks but when i try to connect now with mongo i get connection error
vagrant@m103:/ mongod --port 27000 --dbpath /data/db --logpath /data/logs --replSet M103 --bind_ip [127.0.0.1,192.168.0.100] -fork about to fork child process, waiting until server is ready for connections. forked process: 12396 child process started successfully, parent exiting vagrant@m103:/ mongo --port 27000
MongoDB shell version v3.6.12
connecting to: mongodb://127.0.0.1:27000/?gssapiServiceName=mongodb
2019-04-16T10:23:34.251+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27000, in(checking socket for error after poll), reason: Connection refused
2019-04-16T10:23:34.251+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

Please check your config file and steps again
Remove unnecessary parameters.When you copy config files from previous labs or from /etc you tend to add additional parameters which will cause issues
Do you need replication params?
Which lab your are working on?

You specify this in the config file. You then run the mongod instance you are working with the -f or --config commandline options to tell it where your configuration file is.
e.g. mongod --config /tmp/mongod.conf

Hi there:

I get this message when trying to run the validation script:

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.

I copied the code from the website in order to create the user, so I guess that’s OK… how can I check if the port is the correct one?

The port should be 27000.
Check the lab requirements for more details.

It seems MongoDB is running on port 27017, how can I change it to 27000?

2019-04-23T16:54:51.801+0000 I NETWORK [initandlisten] waiting for connections on port 27017

kill the mongod instance running on port 27017 and kick off another one with port 27000

1 Like

OK, I’ve been trying for two weeks to finish this lab and I’m not capable of, I need detailed instructions of what to do, please…

Please follow lab instructions
Just same way you started the earlier mongod instance

ps -ef|grep mongod
kill old mongod by using PID from above output
kill -9 PID
cleanup db and log dirs
Then kick off new mongod on the correct port

I don’t understand lab instructions; that’s why I’m here after 3 weeks…

Where or when am I supposed to write “ps -ef|grep mongod”? I get a syntax error…

1 Like

What I’m getting now when trying to run the validation script:

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

Hi @JavierBlanco,

You can use ps -ef | grep mongod to check the process id of the running instances of mongoDB (ps command is used to provide information about the currently running processes and grep command is used filter the mongod processes).

Please refer to the the following doc to get information about the basic command line options:

Command Line options

If you are still facing any problem, please share the screenshot of configuration string for launching mongod.

Thanks,
Sonali