[FAIL] Mongod was started with a configuration file

Hi Team,

I am attempting this quiz:

https://university.mongodb.com/mercury/M103/2022_August_9/chapter/Chapter_1_The_Mongod/lesson/5e54544aefd670bb57e10c32/problem

  1. Write the configuration file. There should be an empty configuration file in your IDE File Editor, where you can specify options in YAML.As a reminder, here are the requirements of your mongod instance:
  * run on port **27000**
  * authentication is enabled
  1. When your config file is complete, launch mongod with the --config command line option:

COPY

mongod --config mongod.conf

or using the -f option:

COPY

mongod -f mongod.conf
  1. Once mongod is running, open a new Terminal window and use the following command to create an admin user. You will need to create this user in order to validate your work.

COPY

mongo admin --host localhost:27000 --eval ' db.createUser({ user: "m103-admin", pwd: "m103-pass", roles: [ {role: "root", db: "admin"} ] }) '
  1. Click “Run Tests” to run a suite of tests that will check the configuration of your mongod. The results of these tests will let you know which steps you’ve yet to complete.

mongod.conf file created by me:

# fill out this configuration file, mongod.conf!
# and then use it to run mongod with:
# mongod -f mongod.conf
# network interfaces
storage:
  dbPath: '/data/db' 
  journal:
    enabled: true
  engine:
  mmapv1:
  wiredTiger:

where to write logging data.

systemLog:
  destination: file
  logAppend: true
  path: '/data/logs'

net:
  port: 27000 
security:
  authorization: 'enabled'

admin user account created as instructed:

user@M103# mongo admin --host localhost:27000 --eval '
>   db.createUser({
>     user: "m103-admin",
>     pwd: "m103-pass",
>     roles: [
>       {role: "root", db: "admin"}
>     ]
>   })
> '
MongoDB shell version v4.0.5
connecting to: mongodb://localhost:27000/admin?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("61585c55-0f6e-45c3-9ecc-74111f5a9ac1") }
MongoDB server version: 4.0.5
Successfully added user: {
        "user" : "m103-admin",
        "roles" : [
                {
                        "role" : "root",
                        "db" : "admin"
                }
        ]
}
user@M103# mongod -f mongod.conf
2022-09-04T06:26:03.899+0000 F CONTROL  [main] Failed global initialization: FileNotOpen: Failed to open "/db/data/log/mongodwt.log"
user@M103# 
user@M103# mongod -f mongod.conf
user@M103# mongod --config mongod.conf
user@M103# mongod -f mongod.conf

After completing all steps as instructed and when I click on run tests.

3 total, 1 passed, 0 skipped:
[PASS] "The server is running on localhost:27000"
[FAIL] "The server requires authentication"

Don't forget to launch mongod with authentication enabled!
You can do this using the configuration file.

[FAIL] "Mongod was started with a configuration file"

Did you launch mongod using a configuration file?

Team, let me know what is the issue here?

You have too many parameters in your config file
Please remove all unnecessary ones and try again
Go as per instructions
Also no need to run multiple times as your first attempt failed with logpath issue

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.