I'm trying to install mongodb on windows 7 64-bit. I've extracted the files and copied the bin directory to c:\mongodb. Under c:\mongodb I've placed a configuration file, mongod.cfg, whose content is:
systemLog:
destination: file
path: c:\mongod\data\log\mongod.log
storage:
dbPath: c:\mongod\data\db
I then ran the following command:
mongod.exe --config "C:\mongodb\mongod.cfg" --install
The result was the following error message:
error command line: unrecognized line in 'systemLog:'
I tried to save the cfg file as both ANSI and UTF-8 but it didn't seem to matter. I just want mongodb to be aware of my storage and log settings.
MongoDB configuration files are expressed using YAML. In YAML, litteral string can be expressed using double-quoted style, single-quoted style or plain style (aka "unquoted").
As your path string contains both : and \ you have to use single-quoted style here:
systemLog:
destination: file
path: 'c:\mongod\data\log\mongod.log'
storage:
dbPath: 'c:\mongod\data\db'
In my case this was happening because I had an old db version running and installing the MSI installer didn't upgrade it. When I ran mongod.exe --version, it said I was still running an old db version (2.2.2 for me).
I had to...
mongod --config C:\mongodb\mongod.cfg --removemongod --config C:\mongodb\mongod.cfg --installI'm not sure if the MSI didn't know where to install or what, but now mongod --version returns the proper version number, and no error command line: unrecognized line in 'systemLog:' when installing the service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With