M103 chapter labs

Hi,

This course started on 8 Jan and since then, and it took three days trying to to setup the environment for the course using vagrant and virtualbox, i used vbox version 6 at first and was unable to run vagrant, then i removed everything and downloaded version 5.2, my network connection is very slow though.

And now the assignments labs are due in one day! and I couldn’t finish any of the labs!

I couldn’t run the mongod daemon command, it shows error all the time;

$ mongod --config lab1.conf

about to fork child process, waiting until server is ready for connections.
forked process: 1587
ERROR: child process failed, exited with error number 100
To see additional information in this output, start without the “–fork” option.

my config file setup is:

storage:
dbPath: “/home/data/db”
systemLog:
path: “home/data/lab1.log”
destination: “file”
logAppend: true
net:
bindIp : 127.0.0.1,192.168.103.100
port : 27000
processManagement:
fork : true
security:
authorization: “enabled”

Under systemLog: your path: is wrong.

hi, can you share the correct one please

The value /home/data/lab1.log rather than home/data/lab1.log should work.

i tried this earlier, not working, same error message

Does the directory /home/data/db exists?

yes, still same error message

about to fork child process, waiting until server is ready for connections.
forked process: 2031
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the “–fork” option.

Hi raafat88,

Best way to know the exact problem is to look in the log file: /home/data/lab1.log or as the error message suggests try running mongod without --fork option.

Kanika

Hi Kanika,

Looks like vagrant is not mounting to /home/data folder, i am not sure why !
There is no log files created !
But, i just tried dbPath: “/var/lib/mongodb” and the error message gone, but still mongod daemon didn’t start !

i get this message now

about to fork child process, waiting until server is ready for connections.
forked process: 1834
child process started successfully, parent exiting

but mongod won’t start !

This means mongod has been started, now just run mongo command.

Kanika

running mongo command didn’t start mongo server on the correct port as per the configuration file, instead it throws an error trying to connect to default port 27107

connecting to: mongodb://127.0.0.1:27017
2019-01-15T08:58:54.136+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2019-01-15T08:58:54.172+0000 E QUERY [thread1] Error: couldn’t connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:257:13
@(connect):1:6
exception: connect failed

mongod --config mongod.conf 
about to fork child process, waiting until server is ready for connections.
forked process: 3760
ERROR: child process failed, exited with error number 100
To see additional information in this output, start without the "--fork" 
option.

My mongod.config looks like this

        systemLog:
           destination: file
           path: "/data/db/mongod.log"
           logAppend: true
        storage:
           dbPath: "/var/mongodb/db/"
        net:
           bindIp: "192.168.103.100,localhost"
           port: 27000
        processManagement:
           fork: true

/var/mongodb/db/ exists. user/group/other have rwx. The directory and its subdirectories are owned by vagrant. need guidance

What error do you have in your log file?

Unable to determine status of lock file in the data directory /var/mongodb/db/: boost::filesystem::status: Permission denied: “/var/mongodb/db/mongod.lock”, terminating

Hi Akbar_91991,

Whenever we are dealing with directories like /var/ or /etc/, you need to create them and then change the permissions on the directory so that current user can access the directory.

So, try again after changing the permissions and let me know.

Kanika

Do you mean like this? all directories seem to have read/write capability.

Yes, but you are not in /var/mongod, you are in ~/var/mongod which is the same as /home/vagrant/var/mongod in vagrant. You may use the command pwd to see where you are.