Lab: Configuration File

Hello everyone,
I’m pretty new to this stuff and I’m confused. What configuration file are we supposed to use? Are we supposed to use the example in the previous “Lecture: Configuration File”?

dbPath: “/data/db”
path: “/data/log/mongod.log”
destination: “file”
replSetName: M103
bindIp : “,”
mode: “requireTLS”
certificateKeyFile: “/etc/tls/tls.pem”
CAFile: “/etc/tls/TLSCA.pem”
keyFile: “/data/keyfile”
fork: true

No. It’s an example. You have to start with the file already loaded in the IDE and only add the parameters needed to satisfy the requirements. In this particular case the configuration file that is loaded is empty and as noted in Step 1 of the lab:

As a reminder, here are the requirements of your mongod instance:

  • run on port 27000
  • authentication is enabled
1 Like

Thank you. Now I’m getting the below in the terminal.

sh-4.4# mongod -f mongod.conf
Error parsing YAML config file: yaml-cpp: error at line 2, column 6: illegal map value
try ‘mongod --help’ for more information

Running it again, I now get the below. To be honest, I’m not sure why it is saying something different now.

sh-4.4# mongod -f mongod.conf
Error reading config file: No such file or directory
try ‘mongod --help’ for more information


I found out what I did incorrectly. I used tab instead of space for indentions in the config file.

Hi @Oscar_70723,

I’m glad your issue got resolved. Please feel free to get back to us if you have any other doubts / questions.

~ Shubham

Hi @madhan_gopal,

You are not supposed to share answers to the lab in the discussion forum. Please refrain from doing this in the future. I’ve removed your post.

~ Shubham

Hi every one,

i’m new to this kind of stuff. i got stuck in configuring file. can you guys please help me out here, i have got the below error

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”

Screenshot of the IDE when you started mongod.

A post was split to a new topic: Stuck in this lab : Configuration files

Hi @Srinivas_Mamidala,

Can you please explain the options that you have mentioned in your configuration file ?

The options that you have specified are wrong. Please re-read the instructions mentioned in the lab.

For reference you can refer our documentation as well : Configuration File Options

~ Shubham

Review the lesson where the IDE is presented. You have entered the mongod command in the file editing area.

Hi Ranjan,

please find below config file, i’m using. let me know, i’m going in the correct direction, because i got the same error again.

dbPath: “/data/db”
bindIp : local host
port : 27000
authorization: enabled
mongod -f mongod.conf

i have ran this in the terminal.

Is your mongod up and running?
Please show the screenshot of your terminal where you ran the command

As far as my understanding, this is what i was trying to execute. please see below SS

Those lines in your config file are comments

You are suppose to add parameters as per your lab
1.edit your mongod.conf
2.add parameters the file
Then run mongod -f mongod.conf

i did this,

but, still i got the same error. let me know, i’m i missing some thing,?

this is after runtest

Did you hit enter?
It will display some message
Unless mongod is up and running no point in running your test
It will fail

yes, i did hit enter, before run test.
it gave this below output, before i hit the run test.

sh-4.4# mongod -f mongod.conf
2020-06-10T17:10:49.469+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols ‘none’
2020-06-10T17:10:49.481+0000 I CONTROL [initandlisten] MongoDB starting : pid=329 port=27000 dbpath=/data/db 64-bit host=KsWCggE38CBabQ0stN
2020-06-10T17:10:49.481+0000 I CONTROL [initandlisten] db version v4.0.5
2020-06-10T17:10:49.481+0000 I CONTROL [initandlisten] git version: 3739429dd92b92d1b0ab120911a23d50bf03c412
2020-06-10T17:10:49.481+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1d 10 Sep 2019
2020-06-10T17:10:49.481+0000 I CONTROL [initandlisten] allocator: system
2020-06-10T17:10:49.481+0000 I CONTROL [initandlisten] modules: none
2020-06-10T17:10:49.481+0000 I CONTROL [initandlisten] build environment:
2020-06-10T17:10:49.481+0000 I CONTROL [initandlisten] distarch: x86_64
2020-06-10T17:10:49.481+0000 I CONTROL [initandlisten] target_arch: x86_64
2020-06-10T17:10:49.481+0000 I CONTROL [initandlisten] options: { config: “mongod.conf”, net: { bindIp: “local host”, port: 27000 }, security: { authorization: “enabled” }, storage: { dbPath: “/data/db” } }
2020-06-10T17:10:54.487+0000 W NETWORK [initandlisten] Found no addresses for HostNotFound: Could not find address for local host:27000: SocketException: Host not found (non-authoritative), try again later
2020-06-10T17:10:54.512+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2020-06-10T17:10:55.400+0000 I STORAGE [initandlisten] WiredTiger message [1591809055:400873][329:0x7fa26901fcc8], txn-recover: Set global recovery timestamp: 0
2020-06-10T17:10:55.405+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2020-06-10T17:10:55.426+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2020-06-10T17:10:55.426+0000 I CONTROL [initandlisten]
2020-06-10T17:10:55.428+0000 I STORAGE [initandlisten] createCollection: admin.system.version with provided UUID: 5f5ce137-be4e-41f4-a64f-a99a39ddd510
2020-06-10T17:10:55.440+0000 I COMMAND [initandlisten] setting featureCompatibilityVersion to 4.0
2020-06-10T17:10:55.447+0000 I STORAGE [initandlisten] createCollection: local.startup_log with generated UUID: 12156d0f-5658-47b7-bafd-4200ec28bd2a
2020-06-10T17:10:55.457+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory ‘/data/db/’
2020-06-10T17:10:55.459+0000 I NETWORK [initandlisten] waiting for connections on port 27000
2020-06-10T17:10:55.504+0000 I STORAGE [LogicalSessionCacheRefresh] createCollection: config.system.sessions with generated UUID: f598c423-ed25-4a27-a7f1-0d01018bd3f3
2020-06-10T17:10:55.519+0000 I INDEX [LogicalSessionCacheRefresh] build index on: config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: “lsidTTLIndex”, ns: “config.system.sessions”, expireAfterSeconds: 1800 }
2020-06-10T17:10:55.520+0000 I INDEX [LogicalSessionCacheRefresh] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2020-06-10T17:10:55.521+0000 I INDEX [LogicalSessionCacheRefresh] build index done. scanned 0 total records. 0 secs