Failed to open "/home/vagrant/data/logs/mongod.log"

Hi there! I can’t manage to connect mongod. All the permissions on the data, logs and mongod.log have read and write.

Here is the error:

vagrant@m103:~$ mongod --config “/shared/config.conf”
2019-12-17T19:19:43.106+0000 F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open “/home/vagrant/data/logs/mongod.log”

config.conf file

storage:
dbPath: ‘data/db’
systemLog:
path: ‘data/logs/mongod.log’
destination: file
logAppend: true
net:
bindIp: 192.168.103.100,127.0.0.1
port: 27000
security:
authorization: enabled

Welcome @Diego_Hernandez_O_Hagan_03051

image
What’s happening here is data/db is a different location from /data/db. And also data/logs/mongod.log and /data/logs/mongod.log are different locations.

And if we look at the requirements:


Can you see the problem?

1 Like

Hi @Diego_Hernandez_O_Hagan_03051,

I hope you found the post #2 made by @007_jb helpful.

I would suggest you to get rid of the extra content in your configuration file. You will eventually get to use it in the subsequent labs.

If you still have any confusion then please feel free to get back to us.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

when i type
cat data/log/mongod.log
iam getting error
cat: data/log/mongod.log: No such file or directory

You are probably missing the leading slash. So try cat /data/log/mongod.log.

Hi @SUJANA_42894,

I suspect you are getting this error because of the issue that @steevej-1495 mentioned.

Let me know if you are still stuck with the same issue.

Thanks,
Shubham Ranjan
Curriculum Support Engineer