Running MangoDB as Windows Service

For running mangodb as windows services, first download appropriate version of executable from mangodb web site.

For windows 32 bit, download win 32 bit build.

Unzip files to some location and copy bin files on windows say for example.


Create a default database location, on windows default location is C:\data\db

or you can specify this with ?dbpath args

Now run windows console as Administrator rights and see windows service command line argument

--install install mongodb service

--remove remove mongodb service

--reinstall reinstall mongodb service (equivalent of mongod

--remove followed by mongod --install)

--serviceName arg windows service name

--serviceDisplayName arg windows service display name

--serviceDescription arg windows service description

--serviceUser arg user name service executes as

--servicePassword arg password used to authenticate serviceUser

For running manogdb as windows service ?-logpath argument is compulsory.

Here is complete example

C:\Users\sheel>C:\mangodb\bin\mongod.exe --install --logpath=c:\data\log.log
all output going to: c:\data\log.log


Now open windows service control by running service.msc

and change service startup and other parameters.

You can add additional command line args with ?install command.

blog comments powered by Disqus