First, installation and operation
1. Download:
Official: Https://www.mongodb.com/download-center?jmp=docs&_ga=1.61677796.930985429.1478502988#community
2. Installation
Download the 32-bit or 64-bit. msi file based on your system, double-click the file after downloading, and install it as prompted.
During the installation process, you can set up your installation directory by tapping the custom button.
Now let's create a directory of data and create the data directory in the DB directory.
c:\>cd c:c:\>mkdir data c \>CD data c:\data>mkdir db c:\data>C D db c:\data\db>
You can also create these directories through the Windows Explorer, not necessarily through the command line.
3. Running
In order to run the MongoDB server from the command prompt, you must execute the Mongod.exe file from the bin directory of the MongoDB directory.
Mongod.exe--dbpath c:\data\db
If the execution succeeds, the following information is output:
2015-09-25t15:54:09.212+0800I CONTROL Hotfix KB2731284 or later update is notinstalled, would zero-Out data Files2015-09-25t15:54:09.229+0800 I JOURNAL [Initandlisten] JOURNAL dir=c:\data\db\journal2015-09-25t15:54:09.237+0800I JOURNAL [initandlisten] recover:no JOURNAL files present, no recovery needed2015-09-25t15:54:09.290+0800I JOURNAL [durability] durability thread started2015-09-25t15:54:09.294+0800 I CONTROL [Initandlisten] MongoDB starting:pid=2488 port=27017 dbpath=c:\data\db 64-bit Ho st=win-1vonbjoce882015-09-25t15:54:09.296+0800 I CONTROL [Initandlisten] targetminos:windows 7/Windows Server2008R22015-09-25t15:54:09.298+0800 I CONTROL [initandlisten] DB version v3.0.6...
4. Start
>3.0.6connecting To:test ...
Second, the installation of the occurrence of the situation
1. Flash Back
Solution:
- Setting environment variables
Set the MongoDB bin file to the path of the environment variable: C:\Program files\mongodb\server\3.0\bin. This can be done directly in the console by typing MONGO, Mongod and other commands.
- Create Data Catalog
MongoDB defaults to trying to use the \data\db directory of the current drive as its data directory (such as running Mongod.exe under C:), and by default, the directory is not created automatically, so it will be rolled back.
Of course, you can also set up a data directory anywhere in the system, but in this case you need to specify the path when you start MongoDB. Use the following command:
> Mongod--dbpath C:\mongodb\data\db
This allows you to change the default data directory.
2.waiting for connections on port 27017
Solution:
This is not an error condition, it is normal, the service has been started and is listening to the default port 27017;
You can re-open a new console, run the MONGO command, you can see the details of the connection;
Resources:
1. http://www.runoob.com/mongodb/mongodb-window-install.html
2. http://www.cnblogs.com/chen108/p/4854145.html
3. http://stackoverflow.com/questions/12514119/unable-to-start-launch-local-mongo-db
MongoDB installation using