Problems with log file


I’m having problems when I wont start mongod with this command line:

mongod --replSet TO_BE_SECURED --dbpath ~/M310-HW-1.2/r0 --logpath ~/M310-HW-1.2/r0/mongodb.log --port 31120 --fork --keyFile mongodb-keyfile

I tried without --fork falg and the error is:

2018-09-21T08:31:20.696+0000 I CONTROL  [main] log file "/home/vagrant/M310-HW-1.2/r0/mongodb.log" exists; moved to "/home/vagrant/M310-HW-1.2/r0/mongodb.log.2018-09-21T08-31-20".


J. Alfonso

Hi joseasuarez,

The log message you’ve posted is not an error - it is an informational message. What follows that message ? What error do you get when using fork ? Everything looks ok - although it depends on the staging of directories and keyfile, etc. So you might want to verify those and ake sure the keyfile permissions are correct and that the keyfile is not on the shared directory.

hope that helps,


Thank you, David.

The problem was the keyfile permission. I don’t know what happend it.


J. Alfonso

You need to chmod 400 to the keyfile otherwise you end up with a “keyfile permission too open” error in the log file. Be aware that chmod 400 should give you r-- — --- on your keyfile if you ls -al. However I noticed if you store the file in the shared folder and if your host OS happens to be Windows OS, chmod 400 doesn’t work as expected. You have to copy the file to somewhere else to get the permission properly changed.


Allready fixed the problem.