Chapter 1: The Mongod Lab: Configuration File

I am getting stuck in each lab… is their a way to complete these tasks without asking questions each time, i.e. help on mongodb - site with detail answer?

What all steps do I need to do to complete this lab?

  1. Write the configuration file. How?
  2. create admin user - gave me errors.

M103 - lab 1 Configuration File

  1. bash-4.4# ps -aef | grep [m]ongo
    346 root 0:01 mongod -f mongod.conf

Nothing will help you more than

And check examples there.

The error you see right now, it’s because the config file is empty, and so mongod starts on localhost:27017 (not 27000).

In the document I linked, try to find how to specify

  1. port
  2. authorization

Which is what they ask for.

@Ramesh_Udvadia, I finally got this working by pruning to a barebones config file with only the net.port and security.authorization keys. Also, for some reason, the -f rather than the --config was required. Not sure what’s up with that. See whether that helps.

Share the issue you got with –config because it should not make a difference with -f.

Hi @Michael_Izatt,

Please share the information requested by @steevej-1495. In my understanding as well, you should be able to start your mongod instance using either of the options.

Hi @Ramesh_Udvadia,

It’s okay if you are stuck. We are here to help you and you can ask as many question as you need to :slight_smile:

In the previous lecture, it’s been explained what a configuration file is and what it looks like.

There are some resource present in the lecture notes section as well that you can refer to understand it better.

In this particular lab,

You are supposed to edit the mongod.conf configuration file shown in the Editor space of IDE. Add the required options in the configuration file and start your mongod process.

Once your mongod process is up and running, create the user as per the specification given in the lab.

Hope it helps!!

You are getting error here because the mongod process is not running.

Hi Ramesh,

it seems to me it’s not forbidden to do the following. Have Tab #1 open in your browser to very carefully study the one lecture right before your Lab in question. That lecture - like most - have a “lecture notes” part down below the embedded lecture video where you can find examples of the important files with some brief commenting where they should fit into the process in question.

Let that Tab #1 stay open, and put the following Lab next to Tab #1 in a Tab #2 in your browser. That way you can match the successive points of question in your Lab in Tab #2 with the files in Tab #1.

In my opinion you can see the Labs as a matching exercise, where you often have to match the given questions (in your Tab #2) with example config files and instructions (in your Tab #1), you know?

That said, let’s go back to your questions here. First, you absolutely need to fill in the given mongod.conf file. Copy over its ingredients from Tab #1 and then carefully match its entries with the terms in the Lab question. Do a cat mongod.conf in the IDE terminal below to double-check.

Then do mongo -f mongod.conf to start the daemon. Do ps ef | grep mongod to double-check.

Then connect to mongod process via mongo shell. Do > db you might get test then do > show dbs to double-check you are in the right place. And so forth.

Hope you can move forward, Regards, M.