tutorial on installing MongoDB under Windows

Source: Internet
Author: User
Tags install mongodb mongodb

1. Download MongoDB

Http://www.mongodb.org/downloads

Find your own system version, 32-bit or 64-bit, download down

2. Unzip the downloaded installation package to the directory you want to install

For example: D:\xampp\mongodb, to facilitate the use of the command line, you need to add D:\xampp\mongodb\bin to the path of the system environment variable.

3. Start MongoDB

Start MongoDB using the Mongod--dbpath D:\xampp\mongodb\data command

C:\users\lxy>mongod--dbpath D:\xampp\mongodb\data
Wed APR 17:09:54.468 [Initandlisten] MongoDB starting:pid=12244 port=27017
Dbpath=d:\xampp\mongodb\data 64-bit host=ideabear-pc
Wed APR 17:09:54.469 [initandlisten] DB version v2.4.9
Wed APR 17:09:54.470 [Initandlisten] git version:52fe0d21959e32a5bdbecdc6205
7db386e4e029c
Wed APR 17:09:54.471 [Initandlisten] Build info:windows Sys.getwindowsversio
N (major=6, minor=1, build=7601, platform=2, service_pack= ' Service Pack 1 ') BOOST
_lib_version=1_49
Wed APR 17:09:54.471 [Initandlisten] Allocator:system
Wed APR 17:09:54.472 [Initandlisten] Options: {dbpath: "D:\xampp\mongodb\dat
A "}
Wed APR 17:09:54.519 [Initandlisten] Journal Dir=d:\xampp\mongodb\data\journa
L
Wed APR 17:09:54.520 [Initandlisten] recover:no journal files present, no R
Ecovery needed
Wed APR 17:09:54.542 [fileallocator] allocating new datafile D:\xampp\mongodb
\DATA\LOCAL.NS, filling with zeroes ...
Wed APR 17:09:54.542 [fileallocator] Creating directory D:\xampp\mongodb\data
\_tmp
Wed APR 17:09:54.627 [fileallocator] done allocating datafile D:\xampp\mongod
B\data\local.ns, SIZE:16MB, took 0.083 secs
Wed APR 17:09:54.628 [fileallocator] allocating new datafile D:\xampp\mongodb
\data\local.0, filling with zeroes ...
Wed APR 17:09:54.838 [fileallocator] done allocating datafile D:\xampp\mongod
b\data\local.0, SIZE:64MB, took 0.208 secs
Wed APR 17:09:54.840 [initandlisten] command Local. $cmd command: {create: "s
Tartup_log ", size:10485760, capped:true} ntoreturn:1 keyupdates:0 reslen:37
297ms
Wed APR 17:09:54.844 [Initandlisten] waiting for connections on port 27017
Wed APR 17:09:54.943 [websvr] Admin Web console waiting for connections on PO
RT 28017

The last two lines indicate that the port of the database is 27017 and 28017. Open http://localhost:27017 in the browser and you can see some of its related information.

4. Install MongoDB as Windows service

Using commands Mongod--logpath D:\xampp\mongodb\log\MongoDB.log--logappend--dbpath D:\xampp\mongodb\data--directoryperdb-- ServiceName MongoDB--install Installation Service

Microsoft Windows [version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
D:\xampp\mongodb\bin>mongod--logpath D:\xampp\mongodb\log\MongoDB.log--logappend
--dbpath D:\xampp\mongodb\data--directoryperdb--servicename MongoDB--install
Wed APR 17:23:38.146 trying to install Windows service ' MongoDB '
Wed Apr 17:23:38.546 Service ' MongoDB ' (Mongo DB) installed with command line
' D:\xampp\mongodb\bin\mongod.exe--logpath D:\xampp\mongodb\log\MongoDB.log--l
Ogappend--dbpath D:\xampp\mongodb\data--directoryperdb--service '
Wed APR 17:23:38.546 Service can be started to the command line with ' Net S
Tart MongoDB '

Start Mongodb:net start MongoDB

Stop Mongodb:net Stop MongoDB

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.