Chapter 1: Lab - Configuration File

Can someone please help me? I do not know what I am doing wrong. I created the configuration file and placed it in jackeeclifton/m103/m103-vagrant-env/shared but I am getting an error.

Screen Shot 2020-03-04 at 10.50.13 AM

You start one mongod with mongod --port 27000 … and then right after you start another one with your config file. If your config file specifies the same port number you have a conflict. You must terminate the first one gracefully and try to restart the second one.

Thank you steevej-1495 for your response. I don’t understand what you mean if the config file specifies the same port number you have a conflict. I am sorry. I am new to all of this and think I am getting myself confused.

The requirements for this lab are:
As a reminder, here are the requirements of your mongod instance:

run on port 27000
data files are stored in /data/db/
listens to connections from the IP address 192.168.103.100 and localhost
authentication is enabled

So in configuration file, to satisfy run on port 27000 you specified an item that does the same as --port 27000. If you go back to “Lecture - Configuration File” you will find the item to do that in the link provided which is the following https://docs.mongodb.com/manual/reference/configuration-options/.

1 Like

Hi @Jackee_60553,

I hope you found @steevej-1495’s response helpful.

You can’t have two mongod instances running on the same port or use the same datapath (dbpath).

Please let us know if you have any questions.

Thanks,
Shubham Ranjan
Curriculum Services Engineer

Hi Shubham,
I am getting the same error as i have booted my VM just now and login to shell using vagrant ssh and then used below command:
mongod --config /shared/mongod.cfg
even i tried changing the switch to -f
mongod -f /shared/mongod.cfg

but same error. See screenshot below:
image
Please help.

What is your data path?

You should look at the log file, it will most likely gives clues.

Hi @Deepak_22705,

Please do not ask the same questions in two different threads. I see you are already receiving support from @steevej-1495 and @007_jb in this thread so please continue any further conversation in the same thread :slight_smile:.

Thanks,
Shubham Ranjan
Curriculum Services Engineer

I cant launch mongod.
Anybody knows what am I doing wrong?

systemLog.path requires a filename.

PS: It’s against forum guidelines to post potential answers to labs so I’d suggest that you remove the screenshot of your config file.

1 Like

Still don’t get what is wrong. now it says that “newfile.log” already exists, but i just created it

As it suggests in the error message, “start without the --fork option”… or better still, open the log file to see what it contains.

The newfile.log message is not related to the error. It’s informational “I”, informing you that your log file has been rotated. To circumvent this, look into the logAppend option.

the second attempt was without the “–fork option”. Ok i added the logAppend, when i launch the mongod now i get back a new line, like nothing happened

Suggest you also comment out the systemLog section.
By the way, did you have a look at your log file?

is it in the VM? or on my env?

systemLog.path is your log file. Have a look in that file.
Or like I said before, comment out the systemLog section in your config file.

Nothing, i don’t know how to resolve it. I don’t know how to get into the log file because it’s in the VM and i don’t know what do you mean by “Comment out the systemLog”. This is driving me crazy :smiley: . Help

This is the systemLog section of your config file:
image
You comment out a line by appending “#” to the start of each line. Or delete those 3 lines.

You’re in a Linux environment and the log file is a text file. You can view the contents of a file by using the cat command. A quick Googling will return:
cat <filepath>

I am not understanding what I am doing wrong. Now it tells me “–config: command not found”. Can someone please explain to me so I can understand?

@Jackee_60553, your syntax is incomplete. I would highly recommend that you rewatch “Configuration File” lecture.