Modify the DB and Log storage paths for MongoDB (Windows)-Excerpt from the network

Source: Internet
Author: User
Tags install mongodb

Create a file called mongod.cfg in MongoDB folder if you dont has it. In my Case:c:\users\ivanbtrujillo\mongodb

Then, edit mongod.cfg with Notepad and add a line with the following (our custom DBPath):

dbpath=C:\Users\ivanbtrujillo\MongoDB\data\db

In this file you should especify the LogPath too. My mongod.cfg file is:

logpath=C:\Users\ivanbtrujillo\MongoDB\log\mongo.logdbpath=C:\Users\ivanbtrujillo\MongoDB\data\db

If you are uses MongoDB as a Windows service, you have the "to" change this key and especify the Mongod.cfg file.

To install the MongoDB as a Windows service run this command:

**"C:\Users\ivanbtrujillo\MongoDB\bin\mongod.exe" --config "C:\Users\ivanbtrujillo\MongoDB\mongod.cfg" –install**

Open Regedit.exe and go to the following route:

HKEYLOCALMACHINE\SYSTEM\CurrentControlSet\services\MongoDB

MongoDB service does not work, we had to edit the ImagePath key, delete its content and put the following:

**"C:\Users\ivanbtrujillo\MongoDB\bin\mongod.exe" --config "C:\Users\ivanbtrujillo\MongoDB\mongod.cfg" --logpath="C:\Users\ivanbtrujillo\MongoDB\log\mongo.log" –service**

We indicates to MONGO it's config file and its logpath.

Then when you init the MongoDB service, it works.

Here's a full tutorial to install MongoDB in windows:http://ivanbtrujillo.herokuapp.com/2014/07/24/ installing-mongodb-as-a-service-windows/

Modify the DB and Log storage paths for MongoDB (Windows)-excerpt from the network

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.