Need help copy/running config file

How can I get my notepad created file .cfg in windows (C: drive) to virtual box to run mongod for the ‘Lab - Configuration File’? I thought when we ran the mingw etc.in chapter 1, I saw a reference of ‘rsunc’ to link the windows os (some folder) to virtual box. But can’t figure out how to make use of that.I am a windows guy so please forgive my linux knowledge or lack thereof.

I guess you need to copy it to your vagrant “shared folder” so your virtual machine (the one that runs the mongodb) has access to it. Then within the virtual machine you move the file to the right place.

I highly recommend you edit the file within the virtual machine. It’s way too much work moving the files around. use some basic editor would work. “nano” is easy to learn, “vim” is more powerful. If you will work on linux I highly recommend use vim

The shared folder should be located where you run “vagarant up”

I copied the notepad cfg file there in windows but where is that located in my virtualbox. I am in vagrant ssh and do see a few folders .bash_history, data etc.Am I looking at the wrong spot?

Thank you taking this
Ashok

I shuted down my machine so I cannot verify. I think it’s most likely in your home directory. if not check the root folder. Sorry I am leaving home right now.

And I was silly in my previous comment. You can just leave the conf file in the shared directory, and edit it from your host machine (windows), and in virtual machine you just use “mongod -f path_to_shared_folder/conf_file.conf” to use it directly

if you see .bash_history you are in home directory.

1 Like

I roger that. But the question I have is I don’t see the windows .cfg file in windows shared folder here.
Anyway, I took your advice to learn some linux editor so used nano and it worked. Thank you for the suggestion.
One quick question here when I run that file with the security: authorization: enabled option it didn’ take. I tried a few different ways like with yaml: and then = etc… I am sure I was missing something. I just removed the authorization option and got around that.
Thank you for your help.
Ashok

Hi,

  1. I found the shared folder for you. It’s not in the home directory, it’s in root directory.
  2. did you try “enabled” instead of enable (add quote around the word enable)

Adding on @Guohui_03625, please check for indentation in your config file too.

Kanika

1 Like

So shared on your windows pc would be under where you run vagrant from, which in my case was

D:\Dropbox\MongoDB\M103 - Basic Cluster Administation 15-01-2019\Chapter 0 - Introduction and Setup\shared

So I would run vagrant up from the Chapter 0 - Introducation and Setup

when working with the vagrant environment, it is: -

/shared

so you would: -

cd /shared

As mentioned earlier. However when you come to start creating many conf files later on in the course when doing the sharding section (9 conf’s), then it may be better to edit and view them with a full GUI environment.

Also keep the conf’s you create for each lab separate, so if you make a mistake, you can go back and re apply the changes to your last “valid” one.

Thanks Kanika,

Actually the indentations WERE there but I think the response prompt doesn’t show that. Anyways thank you for reminding.

Ashok