About MongoDB Installation and operation

Source: Internet
Author: User

Recently in learning node. js, MongoDB is used as a database in the project of the instance. The installation process and the pits encountered by MongoDB are then recorded:

1. Download
Address: Http://www.mongodb.org/downloads (32-bit or 64-bit choice).
Note: There is an uncompressed version, and the installation version of MSI is similar.

2, decompression or installation
Unzip the downloaded package, I use the MSI version, installed directly in the C:\Program FILES\MONGODB 2.6 standard Inside

3. Installation Preparation
To set the default data directory for MongoDB. If you do not use the default directory, you need to add the--dbpath parameter (the data file path) to the Mongod.exe command each time you start.

Create a Data Catalog.
Create the log directory and its files.

4. Start MongoDB
Open the cmd window (Cmd.exe), enter C:\Program Files\mongodb 2.6 standard\bin, and execute the mongod.exe command.

Mongod.exe--logpath=d:\dev\mongodb-win32-x86_64-2.4. 5 2.6 Standard\data\db

The--logpath parameter is the path to the set log file. (This parameter can be omitted)
The--dbpath parameter is the set path for the database file. (This parameter must be required)

All parameter options for the Mongod.exe command can be viewed through Mongod.exe--help.

5. Install as a service
If you do not want to enter the above command every time you start, you can install it as a local service.
Open the cmd window of Windows with Administrator privileges and enter the C:\Program files\mongodb 2.6 standard\bin directory.

Mongod.exe--install2.62.6 standard\data\db

The--install parameter is set to install as a server
Note: When installing the DBPath path folder must exist, do not expect him to automatically give you the generation, I am in this place in order to lazy, the result spent a lot of time to find the reason, finally found the problem here.
Once set as a service, you can start or stop MongoDB in the form of a service by using the cmd (Windows CMD window with Administrator privileges Open) window.

net start MongoDB start MongoDB service net stop MongoDB start MongoDB service

6. Enter the shell environment interface
After entering Sheelmongodb, the cmd window enters C:\Program files\mongodb 2.6 standard\bin directory, enter Mongo.exe, you can enter the shell environment interface.

About MongoDB Installation and operation

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.