I am trying to set up MongoDB on Windows, and the online docs seem far from accurate.
Under "Configure a Windows Service" part, step 1 mentions to create a config file. Then it mentions to fill in the file with a line in the format logpath="X:\path\mongo.log"
. However, following the link, the config file is said to be in YAML format, which renders the previous line unreadable in YAML.
I have created a basic mongodb.cfg
(.cfg
or .conf
??) file:
systemLog:
destination: file
path: "P:\\Servers\\MongoDB\\logs\\mongodb.log"
quiet: true
logAppend: true
storage:
dbPath: "P:\\Servers\\MongoDB\\data"
journal:
enabled: true
net:
bindIp: 127.0.0.1
port: 27017
However when I start mongod --config P:\Servers\MongoDB\mongodb.cfg
, the service just won't give any output at all, and just hangs.
If I remove the dbPath
line, it will just close itself with no message at all.
I have also tried to leave the mongodb.cfg
file just like this:
logpath="P:\Servers\MongoDB\logs\mongodb.log"
dbpath="P:\Servers\MongoDB\data"
But execution aborts complaining about any of the 2 paths, even tho they exist. Tried with single backslashes and with escaped backslashes (\\
) with no success.
The only way the service works and listens for connections is to manually pass --dbpath
only, and ignore any config file and logpath at all. Obviously this is not serious, as I need to keep track of the logs and also might need to change config parameters at some later point.
This is nuts... Am I missing something very basic or this docs are a real mess?