MongoDB is configured and accessed through configuration files under Windows
Blog Category:
Mongomongodbwindows Configuration
MongoDB configuration file configuration:The first step: Create a new file in the "D:\Mongodb" directory, command mode, for example, create a new mongodb.conf second step: Configure the configuration items we need in mongodb.conf for specific configuration items, we can pass Bin\mongod-- The Help command determines which configuration items we need to configure to take the Key=value format in the configuration file, and key represents the options,value that needs to be configured to represent the corresponding parameters. If there is no parameter then the corresponding value is NULL for example we are configured in mongodb.conf as follows: TXT code
- Dbpath=d:\mongodb\data
- Logpath=d:\mongodb\log\mongodb.log
- Logappend=
- Journal=
- jsonp=
The DBPath represents the MONGODB database corresponding directory, the parameter corresponding value is D:\Mongodb\datalogpath represents the log file the file path, The value of the parameter is the value of the file path logappend the log information for MongoDB is accumulated instead of overwritten in the log file, there is no parameter value, so value is null journal for the boot log, no parameter value, So value is null JSONP represents allow HTTP access to JSONP format data, no parameter value, so value is empty
to start a service with a configuration file: First step: Enter the Mongodb\bin directory DOS code first through the command line
- C:\Documents and Settings\chenzhou>d:
- D:\>CD D:\Mongodb\bin
Step Two: Start the service with the mongod-f arg command, ARG is the path that represents the configuration file because we define the configuration file in the Mongodb directory, so the ARG value is the D:\Mongodb\mongodb.confDos code
- D:\mongodb\bin>mongod-f D:\Mongodb\mongodb.conf
- All output Going To:d:\mongodb\log\mongodb.log
Configuration of log files:First step: Specify the directory of the log files, for example, we create a new log folder in the "D:\Mongodb" directory, as the log file directory second step: Create a new log file under "D:\Mongodb\log", the file name arbitrary, For example, we define the third step of Mongodb.log: Log file configuration using the command configuration Logpath:mongod--logpath D:\Mongodb\log\ Mongodb.log is configured with a configuration file: Add Logpath=d:\mongodb\log\mongodb.log in mongodb.conf
MongoDB configuration file under Windows configuration