The installation and configuration of the MongoDB 3.2 version in the Windows environment

Source: Internet
Author: User

1. Overview

MongoDB is not supported on Windows XP systems since version 2.2, please use the most recently released version.

1.1 System Requirements

The MongoDB Community Edition requires Windows Server 2008r2,windows Vista or above to provide an installation package in. msi, which can be used to find the desired version from the official website. (The version with legacy is usually the old version). You can run a command in CMD or PowerShell to detect the system version and the number of bits, based on this information to find the appropriate installation package.

WMIC OS Get caption        // or wmic OS get osarchitecture

2. Installation process

2.1 Direct Installation

Double-click the. msi file to install it step-by-step with the wizard, selecting the appropriate installation location (for example: C:\MONGODB)

2.2 Command-line installation

① in the Windows Start menu, enter cmd and run the command line as an administrator with the Ctrl+shift+enter key combination.

② in the Command Line window, locate the folder that has the. msi installation package through some commands (such as CDs), and then enter the following command

msiexec/q/I mongodb-win32-x86_64-signed.msi  installlocation="c:\mongodb" ADDLOCAL ="all"//This is recommended to install all of MongoDB's components in this way

After the installation is complete, you will see the following components (end of EXE) under the C:\mongodb folder

Component Set Binaries
Server Mongod.exe
Router Mongos.exe
Client Mongo.exe
Monitoringtools Mongostat.exe, Mongotop.exe
Inportexportstools Mongodump.exe, Mongorestore.exe, Mongoexport.exe, Mongoimport.exe
Miscellaneoustools Bsondump.exe, Mongofiles.exe, Mongooplog.exe, Mongoperf.exe

3. Running MongoDB

3.1 Direct Installation

MongoDB needs a data directory to store all the data, MongoDB's default data directory is \DATA\DB (relative to the C:\mongodb root directory, \data is the root directory of the secondary directory. ), so you need to create these two folders in the root directory.

MD \data\db

or specify the data directory via Mongod.exe through--dbpath:

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

If you specify a path that contains white space, you need to enclose the entire path in double quotation marks:

" D:\test\mongodb Data "

You can also specify DBPath in the configuration file.

3.2 Running MongoDB

Connect MongoDB by running the Mongo.exe client in a command-line window. (To facilitate the use of commands, the bin path under the installation folder of MongoDB is generally added to the environment variable in path.)

MONGO   // Direct input MONGO can be entered into the MongoDB operator interface

4. Configure MongoDB as a Windows service

① administrator runs the command Window (CMD), creates two new folders under the previous C:\mongodb\data folder db, log

mkdir C:\mongodb\data\db mkdir C:\mongodb\data\log

② Create a configuration file, and the profile needs to contain Systemlog.path, the profile is typically in the root directory of the Software installation (C:\MONGODB\MONGOD.CFG), and you need to specify the following in the configuration file:

systemlog:     destination:file     path:c:\mongodb\data\log\mongod.logstorage:     Dbpath:c:\mongodb\data\db

③ Run the Command window as an administrator and enter the command:

" C:\mongodb\bin\mongod.exe " " C:\mongodb\mongod.cfg " --install

④ Open MongoDB Service

net start MongoDB

⑤ Stop or remove MongoDB service

net stop MongoDB                                            // stop service "C:\mongodb\bin\mongod.exe" --remove        // Removal Service

Refer to https://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/official website for the above content

The installation and configuration of the MongoDB 3.2 version in the Windows environment

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.