Mangodb Windows installation

Source: Internet
Author: User
Tags mongodb download mongodb server

MongoDB Download

MONGODB provides pre-compiled binaries for both 32-bit and 64-bit systems, which you can download from MongoDB website, MongoDB precompiled binary package: Http://www.mongodb.org/downloads

Note: Windows XP systems are no longer supported after the MongoDB2.2 version.

    • MongoDB for Windows 64-bit is suitable for 64-bit Windows Server R2, Windows 7, and the latest version of the Window system.
    • MongoDB for Windows 32-bit is suitable for 32-bit Window systems and the latest Windows Vista. MongoDB databases on 32-bit systems have a maximum of 2GB.
    • MongoDB for Windows 64-bit Legacy is suitable for 64-bit Windows Vista, Windows Server 2003, and Windows Server 2008.

Download the 32-bit or 64-bit. msi file based on your system, double-click the file after downloading, and install it as prompted.

During the installation process, you can set up your installation directory by tapping the custom button.

Create Data Catalog

MongoDB stores the data directory in the DB directory. However, this data directory is not actively created, and we need to create it after the installation is complete. Note that the data directory should be placed under the root directory (e.g. C: \ or D:\. , etc.).

In this tutorial, we've installed MongoDB on the C: disk, now let's create a directory of data and then create the DB directory in the data directory.

C:\>cd C:C:\>mkdir datac:\>cd datac:\data>mkdir DBC :\data>cd DBC:\data\db>         

You can also create these directories through the Windows Explorer, not necessarily through the command line.

Run MongoDB server under command line

In order to run the MongoDB server from the command prompt, you must execute the Mongod.exe file from the bin directory of the MongoDB directory.

Mongod.  --dbpath C:\data\db    

If the execution succeeds, the following information is output:

2015-09-25t15:54:09.212+0800I CONTROLHotfixKB2731284OrLater updateIs NotInstalled,Would zero-OutData files2015-09-25t15:54:09.229+0800I JOURNAL[Initandlisten]Journal Dir=C:\data\db\journal2015-09-25t15:54:09.237+0800I JOURNAL[Initandlisten]Recover: NoJournal Files present, NoRecovery needed2015-09-25t15:54:09.290+0800I JOURNAL[Durability] DurabilityThread started2015-09-25t15:54:09.294+0800I CONTROL[Initandlisten] MongodbStarting:Pid=2488Port=27017DBPath=C:\data\db64-Bit host=WIN-1vonbjoce882015-09-25t15:54:09.296+0800I CONTROL[initandlisten] Targetminos:  windows 7/ windows server 2008 R2< Span class= "lit" >2015-09-25t15 :54:09.298+ 0800 I CONTROL [initandlisten ] db version V3. 0.6 ...             

To run the MongoDB server as a Windows service

Note that you must have administrative privileges to run the following command. Execute the following command to run the MongoDB server as a Windows service:

Mongod.exe--bind_ip youripadress--logpath "C:\data\dbConf\mongodb.log"--logappend--dbpath "C:\data\db"--port Yourportnumber--servicename "Yourservicename"--servicedisplayname "Yourservicename"--install

The following table describes the parameters for MongoDB startup:

Parameters Description
--bind_ip Bind service IP, if bind 127.0.0.1, can only native access, do not specify default local all IP
--logpath Specify the MongoDB log file, note that the specified file is not a directory
--logappend Write a log using an Append method
--dbpath Specify the database path
--port Specifying the service port number, default port 27017
--servicename Specify the service name
--servicedisplayname Specifies the service name that is executed when there are multiple MongoDB services.
--install Specifies the installation as a Windows service.

MongoDB Background Management Shell

If you need to get into MongoDB background management, you need to open the bin directory of the MongoDB directory first, then execute the mongo.exe file, MongoDB Shell is the interactive JavaScript shell that comes with MongoDB, An interactive environment that is used to manipulate and manage MongoDB.

When you enter MongoDB background, it is linked to the test document (database) by default:

> MONGOMongoDB Shell version:3.0.  6connecting to: test...          

Since it is a JavaScript shell, you can run some simple arithmetic operations:

>2+24>    

The db command is used to view the document (database) of the current operation:

> dbtest> 

Insert some simple records and look for it:

>Db.Runoob.Insert({X:10})Writeresult({ "Ninserted" : 1 } ) > Db.. Find () {  "_id"  : objectid ( "5604FF74A274A611B0C990AA"   "x"  : 10 }< Span class= "pun" >>              

The first command inserts the number 10 into the X field of the Runoob collection.

Mangodb Windows installation

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.