How to install MongoDB as a Windows Service

At the first date I heard about NoSQL DBMS, I felt insane. Then I got an eager to learn. But I didn’t pay any attention to learn. Later I got to know that MongoDB is a scalable one. Then I got a chance to follow free MongoDB course. Although I registered to both Developer and DBA courses I had no time to watch developer tutorials. But I finished DBA 1st Week. In that video tutorial they explain how to install MongoDB on Windows as well as on UNIX. But when we are using Mongo in Windows Development Environment it’s a headache to start service again and again. Because of that I wanted to install MongoDB as a Windows Service.

In that video tutorial they explain how to just run MongoDB on Windows Environment. First of all you should have a data directory. For that you should create two folders in the drive that you are planing to install MongoDB. Lets assume that we are going to install MongoDB on D: Drive.

Then you should create two directories(Folders) in D: drive

  • D:\data
  • D:\data\db

You can manually change data path but for a beginner its better to use default path. And if you are trying to install it as Service you need to create a log folder.

  • D:\log

Then open a command prompt and go to the MongoDB bin. I assume you have pasted it on D:\ drive. your directory path will look like this D:\mongodb-win32-x86_64-2.2.0\bin.

After that you should run mongod.exe to install MongoDB as a windows service.

mongod.exe --install --logpath D:\log

When you have type and enter this command on CMD. It will create a Service for MongoDB. You can start MongoDB service with below command.

net start MongoDB

Enjoy Mongo!!!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s