Tag Archives: Configure service

Configure MongoDB Service on Windows Server

Configure MongoDB service on Window Server

1. Create the configuration file:

echo logpath=D:\mongodb\log\mongod.log > "D:\MongoDB\mongod.cfg"
echo dbpath=D:\mongodb\data >> "D:\MongoDB\mongod.cfg"

2. Create service on windows services.msc window.

sc.exe create MongoDB binPath= "\"D:\MongoDB\bin\mongod.exe\" --service --config=\"D:\MongoDB\mongod.cfg\"" DisplayName= "MongoDB 2.6 Standard" start= "auto"

3. Start the MongoDB from the windows Service.

net start MongoDB

Example of error facing during setup of MongoDB
Start the MongoDB service

D:\mongodb>net start MongoDB
The service is not responding to the control function.
More help is available by typing NET HELPMSG 2186.

Check all the folder is created or not present in mongod.cfg file.
I skip to create log folder. I created it and start again.

D:\mongodb>net start MongoDB
The MongoDB 2.6 Standard service is starting.
The MongoDB 2.6 Standard service was started successfully.

4. Stop the MongoDB service.

net stop MongoDB

Note: You can check the log file location also: “D:\MongoDB\mongod.cfg”