MongoDB Study Notes (1)-install MongoDB on Windows

Source: Internet
Author: User
Tags install mongodb mongodb commands
MongoDB Study Notes (1) mdash; install MongoDB on Windows

MongoDB Study Notes (1) mdash; install MongoDB on Windows

Overview

This document describes how to install MongoDB in Windows.

Official website of MongoDB: the latest version is 2.6.7.

Note:

MongoDB does not support Windows XP since Version 2.2. Use the latest version of windows to use the latest version of MongoDB.

If you are running any version of Windows Server 2008 R2 or Windows 7, install a hotfix patch to solve a problem of using memory ing files on Windows.

Patch: Official

Download the Linux community resource station:

------------------------------------------ Split line ------------------------------------------

Free on

Both the user name and password are

The specific download directory is in/July 6,/July 6,/MongoDB Study Notes (1)-install MongoDB on Windows/

For the download method, see

------------------------------------------ Split line ------------------------------------------

Download and install

The official website provides 32-bit and 64-bit zip installation packages and msi installation packages. You can download the zip file and decompress it to the specified directory. You can click msi to run the file without any special attention. Both are easy to install. You need to download and install the appropriate version based on your operating system.

The difference between 32-bit and 64-bit is that a 32-bit mongodb can only store up to 2 GB of data, and there is no limit on 64-bit data.

The operating system used by the author is windows 7x64, MongoDB is the latest 2.6.7 64-bit compressed package, and the decompression path is D: \ mongodb.

Create Database path

Before starting the MongoDB service, you must manually create a folder for storing database files. Otherwise, the folder cannot be started.

The error message shows that the default database path dbpath (\ data \ db \) does not exist. We need to create this directory or specify an existing Directory in -- dbpath.

This document uses the default path to demonstrate how to create the \ data \ db \ directory, which is under the root directory of the mongodb drive letter, that is, D: \ data \ db.

D: \ mongodb> md \ data \ db \

Configure Environment Variables

To facilitate MongoDB command operations, we also configure its environment variables. The operation is also very simple. Take Windows 7 as an example, computer-> right-click menu "properties" to open the "System Properties window"-> "Advanced System settings"-> "advanced" tab-> environment variables, add "D: \ mongodb \ bin" at the end of the path value of the system variable, save the variable, and re-open a command prompt window without entering D: the \ mongodb \ bin directory allows you to quickly execute mongodb commands, such as MongoDB and mongo.

Start MongoDB Service

If the data path is \ data \ dbby default, use mongod.exe or mongod to start the MongoDB service.

D: \ mongodb \ bin> mongodmongod -- help for help and startup options2015-02-07T19: 52: 55.252 + 0800 [initandlisten] MongoDB starting: pid = 6000 port = 27017 dbpath = \ data \ db \ 64-bit host = fanqi-s550c2015-02-07T19: 52: 55.253 + 0800 [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R22015-02-07T19: 52: 55.253 + 0800 [initandlisten] db version v2.6.72015-02-07T19: 52: 55.253 + 0800 [initandlisten] git version: a7d57ad27c382de82e9cb93bf983a80fd9ac98992015-02-07T19: 52: 55.253 + 0800 [initandlisten] build info: windows sys. getwindowsversion (major = 6, minor = 1, build = 7601, platform = 2, service_pack = 'service Pack 1') BOOST_LIB_VERSION = 410492015-02-07t19: 52: 55.253 + 0800 [initandlisten] allocator: system2015-02-07T19: 52: 55.253 + 0800 [initandlisten] options: {} 2015-02-07T19: 52: 55.256 + 0800 [initandlisten] journal dir = \ data \ db \ journal2015-02-07T19: 52: 55.257 + 0800 [initandlisten] recover: no journal files present, no recovery needed2015-02-07T19: 52: 55.277 + 0800 [initandlisten] waiting for connections on port 27017

If the data path is another path, add the -- dbpath parameter to specify the path. Note that if space exists in the path, the entire directory must be enclosed in double quotation marks. Otherwise, an error is returned.

D: \ mongodb \ bin \ mongod.exe -- dbpath D: \ mongodb \ data \ db

From the startup information, we can know that MongoDB is waiting for connection at Port 27017 by default. We can access ": 27017" in a browser to view the relevant information.

Add a MongoDB service to a windows Service

To avoid the tedious startup of services using commands such as cd and mongod every time MongoDB is used, we can add it to the windows Service. The specific commands are as follows:

D: \ mongodb \ bin> mongod -- dbpath = D: \ data \ db -- logpath = D: \ mongodb \ logs \ mongod. log -- install -- serviceName MongoDBD: \ mongodb \ bin> net start MongoDBMongoDB service has been started successfully. D: \ mongodb \ bin> net stop MongoDBMongoDB service has been stopped successfully.

Where:

-- Dbpath: Specifies the database path

-- Logpath: Specifies the file path for saving logs.

-- Install: install windows Services

-- ServiceName: Set the MongoDB service name

Net start MongoDB: start the MongoDB Service

Net stop MongoDB: stop the MongoDB Service

After running the service, we can open the Service Management Interface of windows to see the "MongoDB" service. After that, how can we set it? I believe everyone knows it ,:-).

Install MongoDB2.4.3 in Ubuntu 13.04

MongoDB beginners must read (both concepts and practices)

MongoDB Installation Guide for Ubunu 14.04

MongoDB authoritative Guide (The Definitive Guide) in English [PDF]

Nagios monitoring MongoDB sharded cluster service practice

Build MongoDB Service Based on CentOS 6.5 Operating System

MongoDB details: click here
MongoDB: click here

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.