Installing MongoDB on Windows

Source: Internet
Author: User
Tags install mongodb mongodb client mongodb server mongodb version

Official Document: https://docs.mongodb.org/v2.6/tutorial/install-mongodb-on-windows/

Version based: MongoDB 2.6

Overview

Use this example toinstall MongoDB onthe WI ndows.

Platform Support:

Starting with version 2.2, MongoDB does not support Windows XP, please use the newer MongoDB version of Windows with the latest version.

Important:

If you are using the edition version of Windows Server R2 or Windows 7, install a hotfix to resolve a issue with memory mapped files.

Requirements

If it is a Windows system, then it must be Windows Server R2, Windows Vista or the newer version, the. msi installation package includes all software dependencies, and the older version of MongoDB that was installed through the. msi is automatically upgraded during the installation process.

Get MongoDB

    1. Choose the MongoDB you need

Here are three ways to fit the window.

  

2. Download the MongoDB for window

: https://www.mongodb.org/downloads?_ga=1.211672341.1230752409.1452936071#production

Installing MongoDB

This only describes the compressed version of MongoDB, directly decompression can.

Running MongoDB

  1. Setting up the MONGODB environment

MongoDB needs to have a data directory to store data, mongodb default data directory is \DATA\DB,

You can specify a data directory using the following methods:

C:\mongodb\bin\mongod.exe--dbpath D:\test\mongodb\data

  2. Start MongoDB

Start MongoDB and run Mongod.exe. For example, run in a command-line window:

C:\mongodb\bin\mongod.exe

The startup success is as follows:

    

Several common startup parameters are as follows:

--help,-h

Use the Mongod parameter description information.

--version

The version information for the current MONGODB.

--port <port>

Default: 27017

Start Mongodb:mongod--port xxxx with the specified port, where xxxx is the port number.

--auth

Turn on authentication for user access to the database. Using the auth parameter, access to the use of MongoDB must be verified by a user name and password.

Example: Mongod-auth--port 27017

--noauth

Turn off authentication, which is started by default in a non-certified manner.

--dbpath <path>

Linux and OS X default is/data/db,window is \data\db.

Specify the database file path for MongoDB

Example: Mongod-auth--port 27017--dbpath=c:\dev_environment\mongodb-win32-i386-2.6.11\db

For a detailed description of the command parameters for MongoDB startup, refer to: Mongod.exe and Mongod.

  3. Connect MongoDB

Connect MongoDB through the Mongo.exe shell, open another command-line window,

C:\mongodb\bin\mongo.exe

Several common connection parameters are as follows:

--port <port>

The port number of the MongoDB service to which the MongoDB client is connecting

--host

The host name (IP address) of the MongoDB server to which the MongoDB client is connecting

--username <username>,-u <username>

Use with--password <password> and--authenticationdatabase parameters when you want to log in to a MongoDB database that needs to be validated.

For example: MONGO--port 27017-u "test"-P "123456"--authenticationdatabase "test"

--authenticationdatabase <dbname>

Occurs in version 2.4, which specifies the database to validate.

--authenticationmechanism <name>

Specifies the authentication mechanism of the authenticated user, the default is MONGODB-CR, this parameter is starting from version 2.4, starting from version 2.6, added to the plain and mongodb-x509 authentication mechanism support, it should be noted that the different versions of the MONGODB authentication mechanism is not the same, So it may cause different versions of the client to be authenticated on other MongoDB does not pass. Also, if you use Java connection, the driver version and MongoDB version is also closely related, because the version is incompatible, may lead to authentication does not pass.

For mongodb Connection command parameters Please refer to: Mongo.exe.

  4. Close the MongoDB database

In the Command line window that launches the MongoDB database, press Control+c.

Start MongoDB with the Windows service.

Specific operation reference: https://docs.mongodb.org/v2.6/tutorial/install-mongodb-on-windows/#configure-a-windows-service-for-mongodb

Installing MongoDB on Windows

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.