Install MongoDB as a Windows Service

Installing MongoDB as a service on my Windows 7 turned out to be pretty simple. 

Download Mongo – http://www.mongodb.org/downloads

Follow Instructions – http://www.mongodb.org/display/DOCS/Windows+Service

There was one gotcha I ran into as I did the install.  If you specify an invalid data path the service will be stuck in an infinite loop of restarts, and have to be removed (or create the missing directory).

My install command :

   1: D:\Tools\MongoDB\mongodb-win32-x86_64-2.0.2\bin\mongod --logpath C:\Data\Development\logs\MongoDB.log --logappend --dbpath C:\Data\Development\MongoDB_Data --install --serviceName MongoDB

 

Here is the exception I was getting in my log file:

   1: ***** SERVER RESTARTED *****

   2:  

   3:  

   4: Sun Mar 04 10:20:08 [initandlisten] MongoDB starting : pid=6652 port=27017 dbpath=C:\Data\Development\OneBrownMule\OneBrownMule.Web\App_Data\AppDB 64-bit host=mueller-laptop2

   5: Sun Mar 04 10:20:08 [initandlisten] db version v2.0.2, pdfile version 4.5

   6: Sun Mar 04 10:20:08 [initandlisten] git version: 514b122d308928517f5841888ceaa4246a7f18e3

   7: Sun Mar 04 10:20:08 [initandlisten] build info: windows (6, 1, 7601, 2, 'Service Pack 1') BOOST_LIB_VERSION=1_42

   8: Sun Mar 04 10:20:08 [initandlisten] options: { dbpath: "C:\Data\Development\MongoDB_Data", logappend: true, logpath: "C:\Data\Development\logs\MongoDB.log", service: true }

   9: Sun Mar 04 10:20:08 [initandlisten] exception in initAndListen: 10296 dbpath (C:\Data\Development\MongoDB_Data) does not exist, terminating

  10: Sun Mar 04 10:20:08 dbexit: 

  11: Sun Mar 04 10:20:08 [initandlisten] shutdown: going to close listening sockets...

  12: Sun Mar 04 10:20:08 [initandlisten] shutdown: going to flush diaglog...

  13: Sun Mar 04 10:20:08 [initandlisten] shutdown: going to close sockets...

  14: Sun Mar 04 10:20:08 [initandlisten] shutdown: waiting for fs preallocator...

  15: Sun Mar 04 10:20:08 [initandlisten] shutdown: lock for final commit...

  16: Sun Mar 04 10:20:08 [initandlisten] shutdown: final commit...

  17: Sun Mar 04 10:20:08 [initandlisten] shutdown: closing all files...

  18: Sun Mar 04 10:20:08 [initandlisten] closeAllFiles() finished

  19: Sun Mar 04 10:20:08 dbexit: really exiting now

Tags :

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Leave Comment

*