MongoDB in Windows profile configuration and Access methods

Source: Internet
Author: User
Tags mongodb
Sqlserver/42852.htm Target=_blank >

MongoDB configuration file configuration:
Step one: Create a new file in the "D:mongodb" directory, not limited to the command, such as creating a new mongodb.conf
Step Two: Configure the configuration items we need in mongodb.conf
For specific configuration items, we can use the Binmongod--help command to determine which configuration items we need to configure
In the configuration file to take Key=value format, the key represents the need to configure the Options,value representative of the corresponding parameters, if there is no parameter of the corresponding value is empty
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 represents the directory corresponding to the MongoDB database, and the corresponding value of the parameter is D:mongodbdata
LogPath represents the file path of the log file, and the parameter value is the value of the file path
Logappend the log information on behalf of the MongoDB is accumulated in the log file instead of overridden, and there is no parameter value, so value is empty
Journal on behalf of the startup log, no parameter values, so value is empty
JSONP representative allows access to JSONP format data via HTTP, no parameter values, so value is empty
To start a service from a configuration file:
First step: First through the command line into the Mongodbbin directory
DOS Code

The code is as follows Copy Code
C:documents and Settingschenzhou>d:
D:>CD D:mongodbbin


Step Two: Start the service with the Mongod-f ARG command, which is the path that represents the configuration file.
Because we define the configuration file in 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

Configuration of log files:
Step One: First specify the directory of the log file, for example, we create a new log folder in the "D:mongodb" directory, as a log file directory
Step two: Under "D:mongodblog" Create a new log file, the filename is arbitrary, for example, we define as Mongodb.log
Step three: Configuration of log files
Using Command configuration

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


Use a 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.