Windows Platform Installation MongoDB

Source: Internet
Author: User
Tags mongodb download mongodb server

MongoDB Download

MongoDB provides precompiled binary packages for 32-bit and 64-bit systems that you can download from the MongoDB official website, MongoDB precompiled binary package:

Http://www.mongodb.org/downloads

Extract

After downloading the zip package, unzip the installation package and install it.

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 created under the root directory (for example, C: \ or D:\. , etc.).

In this tutorial, we have extracted the MongoDB file in the D: disk, now let's create a directory of data and then create the DB directory in the data directory.

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.

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--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
--servicedisplaynam 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:

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

The DB command first documents the current operation (database):

Insert some simple records and look for it:

The first command inserts 10 into the X field of the W3r collection

Windows Platform Installation 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.