Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB: Setting up Windows Service

Tags:

mongodb

I have just installed MongoDB 2.6 and I am trying to run it as a Windows Service on Windows 8, by following the instructions at http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/.

Here's my directory structure within the C drive:

  • MongoDB (MongoDB installation)
    • bin
  • Project
    • DB
    • Log
    • mongo.conf
    • mongod.cfg

The contents of mongo.conf is:

storage:
   dbPath: "C:\Project\DB"

And the contents of mongod.cfg is:

logpath="C:\Project\Log\mongo.log" 

As directed to in the tutorial, from the command line (in administrator mode) I then type:

"C:\MongoDB\bin\mongod.exe" --config "C:\Project\mongod.cfg" --install

However, I get an error message:

SEVERE: Failed global initialization: FileNotOpen Failed to open ""C:\MongoDB\bin\Project\Log\mongo.log""

Please can somebody explain what I'm doing wrong? I've followed the instructions as dictated in the tutorial (except changed some of the directory names).

I'm also very confused as to the difference between mongo.conf and mongod.cfg...

Thanks!

like image 496
Karnivaurus Avatar asked Apr 15 '14 22:04

Karnivaurus


1 Answers

I was having a similar problem with Mongo 2.6.3. I was trying to set the log path to C:\Users\Public\Public Databases\Mongo\log\mongo.log and the service installer kept responding with Failed to open ""C:\Program Files\MongoDB 2.6 Standard\bin\Users\Public\Public Databases\Mongo\log\mongo.log"".

It started working for me when I stopped quoting the log path in the config file. (i.e. I changed logpath="C:\Users\Public\Public Databases\Mongo\log\mongo.log" to logpath=C:\Users\Public\Public Databases\Mongo\log\mongo.log).

like image 118
Tristan Wilkinson Avatar answered Oct 14 '22 05:10

Tristan Wilkinson