How to configure and access the Mongodb configuration file in windows

Source: Internet
Author: User

This article introduces how to configure and access the Mongodb configuration file in windows. For more information, see. Sqlserver/42852.htm target = _ blank>

Mongodb configuration file Configuration:
Step 1: create a file in the "D: Mongodb" directory. The command method is not limited. For example, create a mongodb. conf file.
Step 2: configure the required configuration items in mongodb. conf
For specific configuration items, we can use the binmongod -- help Command to determine the configuration items we need to configure
In the configuration file, the key = value format is used. The key represents the options to be configured, and the value represents the corresponding parameter. If there is no parameter, the corresponding value is null.
For example, we configure the following in mongodb. conf:
Txt code

The Code is as follows: Copy code
Dbpath = D: Mongodbdata
Logpath = D: MongodblogMongodb. log
Logappend =
Journal =
Jsonp =

Detailed description:
Dbpath indicates the directory corresponding to the Mongodb database. The parameter value is D: Mongodbdata.
Logpath indicates the file path of the log file. The parameter value is the file path value.
Logappend indicates that the Mongodb log information is accumulated in the log file instead of overwritten. No parameter value exists, so the value is empty.
Journal indicates the startup log. There is no parameter value, so the value is empty.
Jsonp indicates that data in jsonp format can be accessed through http. No parameter value exists, so value is empty.
Start the service through the configuration file:
Step 1: first enter the Mongodbbin directory through the command line
Dos code

The Code is as follows: Copy code
C: Documents and Settingschenzhou> D:
D:> cd D: Mongodbbin


Step 2: run the mongod-f arg command to start the service. arg represents the path of the configuration file.
Because we define the configuration file under the Mongodb directory, the arg value is D: Mongodbmongodb. conf
Dos code

The Code is as follows: Copy code
D: Mongodbbin> mongod-f D: Mongodbmongodb. conf
All output going to: D: MongodblogMongodb. log

Log File Configuration:
Step 1: first specify the directory of the log file. For example, create a log folder under the "D: Mongodb" directory as the storage directory of the log file.
Step 2: Create a New log file under "D: Mongodblog". The file name is arbitrary. For example, we define it as Mongodb. log.
Step 3: configure the log file
Configure using commands

The Code is as follows: Copy code
Logpath: mongod -- logpath D: MongodblogMongodb. log


Use the configuration file to configure:

The Code is as follows: Copy code
Add logpath = D: MongodblogMongodb. log in mongodb. conf

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.