Error reading config file: No such file or directory

File Location: C:\Users\amitayadav\m103\m103-vagrant-env\shared\mongod.conf

storage:
dbPath: “/data/db”
systemLog:
destination: “file”
path: “/data/log/mongod.log”
replication:
replSetName: “M103”
net:
bindIp: “127.0.0.1,192.168.103.100”
ssl:
mode: “requireSSL”
PEMKeyFile: “/etc/ssl/ssl.pem”
CAFile: “/etc/ssl/SSLCA.pem”
security:
keyFile: “/data/keyfile”
processManagement:
fork: true

vagrant@m103:~$ mongod -f /shared/mongod.conf

Error reading config file: No such file or directory

Hi @Amita_62847,

Please run these commands at the vagrant prompt and share the output.

cd /shared

To change the directory

ls

To view the content of the current directory.

Note : The content in your configuration file is not correct. I would suggest you to read the instructions mentioned in the Lab carefully and remove the unnecessary fields from the config file.

For more information you can refer our documentation - Configuration File

Thanks,
Shubham Ranjan
Curriculum Support Engineer

vagrant@m103:/shared$ ls
mongod.conf.txt

what is wrong in the conf file?

vagrant@m103:/$ mongod -f /shared/mongod.conf.txt

Unrecognized option: ssl.mode
try ‘mongod --help’ for more information

vagrant@m103:/$ mongod -f /shared/mongod.conf.txt
about to fork child process, waiting until server is ready for connections.
forked process: 14044

ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the “–fork” option.

storage:
dbPath: “/data/db”
systemLog:
destination: “file”
path: “/data/log/mongod.log”
replication:
replSetName: “M103”
net:
bindIp: “127.0.0.1,192.168.103.100”
security:
keyFile: “/data/keyfile”
processManagement:
fork: true

Hi @Amita_62847,

This was the problem. I would recommend you to remove the .txt extension as it does not really serve any purpose here.

The content in this configuration file was given as an example in the Lecture notes. The fields that are specified here isn’t something which you need in this Lab.

You need to have entries for only these fields in your configuration file.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

Now the file content is :

storage:
dbPath: “/data/db”
systemLog:
destination: “file”
path: “/data/log/mongod.log”
net:
port: 27000
bindIp: “127.0.0.1,192.168.103.100”
security:
keyFile: “/data/keyfile”
processManagement:
fork: true

please tell for authentication which key value is used

and also in windows there is only one option to create conf file i.e. text document. how can I change the extension?

vagrant@m103:/shared$ ls

mongod.cfg

vagrant@m103:/shared$ mongod -f /shared/mongod.cfg

about to fork child process, waiting until server is ready for connections.
forked process: 14476
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the “–fork” option.

Hi @Amita_62847,

Please share the output of this command (last 40-50 lines).

cat /data/log/mongod.log

In addition to that, please make sure you don’t have any unnecessary fields present in your configuration file.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

vagrant@m103:/$ cat /data/log/mongod.log
cat: /data/log/mongod.log: No such file or directory

Hi @Amita_62847,

I would like to see the content of your configuration file. Please check your inbox and share the content of your configuration file there only.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

Waiting for your response sir.

Hi @Amita_62847,

Please confirm that your issue has been resolved so that I can close the thread.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

sure, please close the thread and thanks for helping me out.