In MongoDB 2.6, the steps provided in this site on how to install MongoDB as a service is not working correctly. They confirmed that this is a bug and that a fix will come up soon. In the meantime, here is a work around for this issue.
- Install MongoDB.
My directory is at “C:\Program Files\MongoDB 2.6 Standard” - Create this folder: “C:\Program Files\MongoDB 2.6 Standard\data\db”
- Create this folder and file: “C:\Program Files\MongoDB 2.6 Standard\logs\mongo.log”
- Create this file: “C:\Program Files\MongoDB 2.6 Standard\mongod.cfg”
- Inside mongod.cfg, insert these values:
logpath="C:\Program Files\MongoDB 2.6 Standard\logs\mongo.log"
dbpath="C:\Program Files\MongoDB 2.6 Standard\data\db" - Run this command in the command prompt:
sc create MongoDB binPath= "\"C:\Program Files\MongoDB 2.6 Standard\bin\mongod.exe\" --service --config=\"C:\Program Files\MongoDB 2.6 Standard\mongod.cfg\""DisplayName= "MongoDB 2.6 Standard" start= "auto"
- Run regedit.exe and navigate to HKEY_LOCAL_MACHINE >> SYSTEM >> CurrentControlSet >> services >> MongoDB
- Modify ImagePath by inserting these new values:
"C:\Program Files\MongoDB 2.6 Standard\bin\mongod" --service --rest --master --logpath="C:\Program Files\MongoDB 2.6 Standard\logs\mongo.log" --dbpath="C:\Program Files\MongoDB 2.6 Standard\data\db"
- Try to check http://localhost:28017/ if it’s accessible.
Advertisements