MongoDB General Installation
1. First to the official website (http://www.mongodb.org/downloads) Download the appropriate installation package, the current version is 2.6
Installation package has zip and MSI format, it is recommended to download the ZIP format, the MSI is actually the next decompression, and the installation does not allow the selection of installation path, the default installation to the C:\Program FILES\MONGODB 2.6 standard directory, Choose 32-bit or 64-bit according to your system.
I am the computer is WIN8 system 64-bit, download 64-bit zip package, download completed after extracting to D:\MongoDB directory
To create the database directory D:\MongoDB\data, then open the Command Line window and switch to the D:\MongoDB\bin directory to execute the following command:
Where--dbpath is the specified database storage directory, there are two "-" to be aware of
Mongod--dbpath D:\MongoDB\data
This is a command-line window that prints some startup information, and the last line displays the following information to indicate that the boot was successful.
2014 -04 -23t10:38 : 48.391 + 0800 [Initandlisten] Waiting For connections on port 27017
This is the browser input http://localhost:27017/can see the display information for
It looks like you is trying to access MongoDB over HTTP on the native driver port.
Specific as follows:
To this MongoDB is installed, than imagined simple too Doha
MongoDB is installed as a Windows service
Installing MongoDB as a Windows service is simple, just add--install after the command line that you executed above
Mongod--dbpath D:\MongoDB\data--install
According to the normal plot, the service should be installed successfully, but unfortunately, the following prompt appears
--install have to is used with--logpath
As prompted, we need to specify the log directory, so we create the log directory D:\MongoDB\logs and then re-execute the command
Mongod--dbpath D:\MongoDB\data--logpath=d:\mongodb\logs\mongodb. Log --logappend
However, the hint still does not specify the log path, after several toss found that this is a 2.6 version of a bug, will be repaired in the next version, then we have two options, one option is to use the previous version of 2.4.9, the other option is to first use 2.4.9 version of the installation successful service, and then upgrade to 2.6 (swollen upgrade? Replace the corresponding 2.4.9 file directly with version 2.6, and we have other options, of course, yes, the answer is yes, using the SC command to create the service, start the service with net start
SC create MongoDB binpath= "D:\MongoDB\bin\mongod.exe--service--dbpath D:\MongoDB\data--logpath=d:\mongodb\logs\ Mongodb.log --logappend "
net start MongoDB
MongoDB configuration file
Unfortunately, the official download of the installation package does not have a default configuration file, if you want to use the configuration file can only build one, and the other person also recommended to use the configuration file to manage MongoDB configuration, using configuration file configuration database files, log files and some other configuration is at a glance
Unpack the installation package to D:\MongoDB
Set up the database directory D:\MongoDB\data
Create log directory D:\MongoDB\logs
Create profile Directory D:\MongoDB\etc
Setting up the configuration file D:\MongoDB\etc\mongodb.conf
Dbpath=D:\MongoDB\data #数据库路径logpath=D:\MongoDB\logs\mongodb.log #日志输出文件路径logappend=true # Error log in Append mode, configure this option after MongoDB log is appended to the existing log file, instead of creating a new file Journal=true #启用日志文件, enabled by default quiet=true # This option can filter out some useless log information, if need to debug use set to Falseport=27017 #端口号 default is 27017
Only a few common items are specified here, please refer to the official documentation for more detailed configuration http://docs.mongodb.org/manual/reference/configuration-options/
Note: The above directory is the blogger's own set of directories, the official does not have the configuration file path specification, all based on personal preferences to decide
After the configuration files and related directories have been built, use the following method to start MongoDB.
It is important to note that when a log file is specified, the log is output to the specified log file, regardless of whether it is specified using the configuration file or at the command line, and no log output is visible at the command line interface
Note:
Version 2.6 cannot install Windows Services Bug link https://jira.mongodb.org/browse/SERVER-13515
MongoDB Website: http://www.mongodb.org/
MongoDB Windows environment Installation and configuration