Configuration File - YAML issues

Hi Everyone!
I’m stucked in the Configuration File Lab. I find my problem is related with my comprehension of YAML files. I understand YAML files are kind of similar to a json file. Their purpose is to bring nested data. I made my .conf file by writing this on a .txt file:

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

I changed its extension to .conf and I put it in my shared folder to use it in the VM. I used this command to run mongod with that .conf file:

vagrant@m103:/$ mongod --config /shared/mongod.conf

And the terminals sends me this message:

Error parsing YAML config file: yaml-cpp: error at line 1, column 76: illegal map value

By the way I’m using macOs.

Thank you! I appreciate your help.

1 Like

Please check indentation or quotes could be wrong
Don’t use tabs for space use space bar

Hi @Fenaki,

Please refer an example configuration file shown in the previous lecture and make sure you have used proper indentation in your configuration file.

Please use straight quotes or you can also remove all the quotes that you have used in your configuration file to avoid any error.

Please feel free to get back to us if you have any other query.

Thanks,
Shubham Ranjan
Curriculum Services Engineer

Hi Shubham Ranjan
i was struck here and now in am on port 27017 but in configuration lab mentioned port 27000
not only about port 27000 i am totally confused. The commands are to be used in mongo shell OR virtual box guide me .i will post some screenshots below .


this is one more problem


after this i am reset again and i am able to use

one more last question
When your config file is complete, launch mongod with the --config <config_filepath> command line option with the filepath to your config file in place of config_filepath (you can also use the -f option instead of --config).

When you’re finished, run the following validation script in your vagrant and outside the mongo shell and enter the validation key you receive below. If you receive an error, it should give you some idea of what went wrong.
vagrant@m103:~$ validate_lab_configuration_file
The validate command execute in virtual box?

thanking you

regarding
venkata

one screenshot missing after restarting

Venkata,

You have to be running this from the vagrant shell. Did you actually setup an actual virtualbox VM? This should have been done in Chapter 0 I believe. If you ran the correct config option from the vagrant shell (btw, I opened a secondary window, vagrant ssh into it and ran the validate command), your mongod process should be running.

I noticed another window where it looks like you tried to cut and paste the contents of the config file in your terminal. you should open an editor within vagrant (I used vim) and add the content there.

can you tell some briefly .
i need to change my port 27010 to 27000 and also configuration setup and run validate command guide these three.

thanking you

Hi tried again but again error

after creating the user

for virtual machine environment

here i created username and password after that i run validate command in both VM&mongoshell but i am getting error regarding port 27000

thanking you

Is your user created successfully?
From your above snapshot it failed
Please run the command at os prompt.Your are running at mongo shell That’s why it is failing with syntax error
If your mongod is up and running no need to run again
Just confirm by ps -ef|grep mongo
You have to pass config file
mongod --f config_file
or mongod --config config_file

still i am struck here

It looks like you are starting mongod in Windows. Aren’t you supposed to do it in vagrant VM?

1 Like

I tried in vagrant vm also
after login with user id and password in vagrant its look like vagrant@m103~$:
i gave this command line in vagrant immediately
mongod --port 27000 --dbpath /data/db --auth --bind_ip 192.168.103.100,127.0.0.1,
after few mins its says waiting for connections on port 27000 and its struck

It is not stuck
“waiting for connection means” your mongod is up and running
Just need to connect to mongod
Please open another session and connect using mongo --port

Please note if we do not use --fork while starting mongod it runs in foreground and your session appears to be hung
Just leave this session and connect from another session
If you use --fork along with the command line parameters you used it will run in background and your session returns to Unix prompt and you can connect from same session by mongo
Hope it is clear
You can try both options and check for yourself

1 Like

Hi @venkata_97387,

In addition to @Ramachandra_37567,

I will recommend you to revisit this video lecture - Chapter 1: The Mongod.

And also in this course you are supposed to run all the commands in the Vagrant machine and not at your host OS prompt except the Vagrant up and Vagrant ssh command.

Hope it helps!

Please feel free to get back to us if you have any other query.

Thanks,
Shubham Ranjan
Curriculum Services Engineer