Download
MongoDB website Download link
If the wall, please click Mongodb-win32-x86_64-2008plus-ssl-3.4.1-signed.msi download
Choose Custom installation mode, manually switch the installation directory, such as: Installed in the D:\Development_Tools\MongoDB (do not install in the default location, system disk protection, a lot of operation is difficult to suffer)
Configuring Environment variables
After the installation is successful, add the Bin directory under the MongoDB directory to the path variable, under path:
D:\Development_Tools\MongoDB\bin
Installation Method 1:
- Create database file directory and log file storage directory
D:\Development_Tools\MongoDB New Data folder, data under the DB and log folder, log blank file Mongodb.log
Create database File storage directory: D:\Development_Tools\MongoDB\db
Create log file storage directory: D:\Development_Tools\MongoDB\db\log
Create a blank log file: D:\Development_Tools\MongoDB\db\log\mongodb.log
- Search cmd, right-click on the (WIN10) menu to run as Administrator;
- Switch to the bin directory
Common Linux Commands:
CD/ return root directory, D: cut to D CD D:\Development_Tools\MongoDB\bin (if folder contains spaces, need double quotation marks, for example: CD "program Files\mongodb\server\ 3.4\bin ")
Input:
Mongod--dbpath D:\Development_Tools\MongoDB\data\db--logpath=d:\development_tools\mongodb\data\log\mongodb.log- -logappend
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.
2017-05-29t17:23:16.752+0800 I NETWORK [thread1] waiting for connections on port 27017
Note: If you fail
,
Try entering only:
Mongod--dbpath D:\MongoDB\data\db # where--dbpath is the specified database storage directory
If the output shows the above information, then the administrator mode opens a DOS window, enter
Mongod--dbpath D:\Development_Tools\MongoDB\data\db--logpath=d:\development_tools\mongodb\data\log\mongodb.log- -logappend
Check that the output information is correct.
- Install as a Windows service
Input:
SC create MongoDB binpath= "D:\Development_Tools\MongoDB\bin\mongod.exe--service--dbpath D:\Development_Tools\ Mongodb\data\db--logpath=d:\development_tools\mongodb\data\log\mongodb.log--logappend "
Display: [SC] CreateService success
net start MongoDB
Display: MongoDB service is starting .....
MongoDB Service has started successfully
- If it fails, delete the service:
Input:
Mongod--remove--servicename "MongoDB"
Close DOS window, delete D:\Development_Tools\MongoDB\data\db under Mongod.lock file, Administrator mode to open cmd, re-enter
SC create MongoDB binpath= "D:\Development_Tools\MongoDB\bin\mongod.exe--service--dbpath D:\Development_Tools\ Mongodb\data\db--logpath=d:\development_tools\mongodb\data\log\mongodb.log--logappend "
Start the service again:
net start MongoDB
- Opens the browser, accesses http://127.0.0.1:27017/, displays the following content to indicate the installation success
It looks like you is trying to access MongoDB over HTTP on the native driver port.
The second method (with a configuration file):
installation directory D:\Development_Tools\MongoDB
Set up the database directory D:\Development_Tools\MongoDB\data\db
Create log directory D:\Development_Tools\MongoDB\data\log
Create profile Directory D:\Development_Tools\MongoDB\etc
Setting up the configuration file D:\Development_Tools\MongoDB\etc\mongodb.conf
mongodb.conf Add the following configuration file:
DBPATH=D:\DEVELOPMENT_TOOLS\MONGODB\DATA\DB # database Path Logpath=d:\development_tools\mongodb\data\log\mongodb.log # Log output file path 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 # Enable log file, enabled by default Quiet=true # This option can filter out some useless log information, if need to debug use please set to falseport=27017 # port number default is 27017
Only a few common items are specified here, please refer to the official documentation for more detailed configuration https://docs.mongodb.org/manual/reference/configuration-options/
Administrator mode open cmd switch to the bin directory, refer to the above steps.
Input:
Mongod--config D:\Development_Tools\MongoDB\etc\mongodb.conf
Input:
Mongod--config D:\Development_Tools\MongoDB\etc\mongodb.conf--install
Using the SC installation as a Windows service
SC create MongoDB binpath= "D:\Development_Tools\MongoDB\bin\mongod.exe--service--config=d:\development_tools\ Mongodb\etc\mongodb.conf "
Show:
[SC] CreateService success
Input:
net start MongoDB
Show:
The MongoDB service is starting.
MongoDB Service has started successfully.
Opens the browser, accesses the http://127.0.0.1:27017/, displays the following content to indicate the installation success:
It looks like you is trying to access MongoDB over HTTP on the native driver port.
Input: MONGO
Show:
MongoDB Shell version v3.4.1
Connecting to:mongodb://127.0.0.1:27017
MongoDB Server version:3.4.1
Administrator to open cmd, enter:
net stop MongoDB
After you start the close MongoDB service process is:
SC create MongoDB binpath= "D:\Development_Tools\MongoDB\bin\mongod.exe--service--dbpath D:\Development_Tools\ Mongodb\data\db--logpath=d:\development_tools\mongodb\data\log\mongodb.log--logappend "net start MongoDBnet stop Mongodb
Reference Blog 1:https://vxhly.github.io/2017/05/install-mongodb-on-windwos/
Reference Blog 2:http://blog.csdn.net/zhouzhiwengang/article/details/44277499
This article link: http://www.cnblogs.com/W-Yentl/p/7825615.html
Win10 under MongoDB Installation