Win10 under MongoDB Installation

Source: Internet
Author: User
Tags create mongodb mongodb server

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

    • Start MongoDB Service
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):
    • New directory:

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

    • Configuration file:

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/

    • Startup configuration

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
    • Installation Services

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

    • Start the service

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.

    • Test:

Input: MONGO

Show:

MongoDB Shell version v3.4.1
Connecting to:mongodb://127.0.0.1:27017
MongoDB Server version:3.4.1

    • To close the service:

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

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.