MongoDB Learning (a): The construction of MONGODB environment

Source: Internet
Author: User
Tags mongodb mongodb version win32 port number
MongoDB Learning (a): The construction of MONGODB environment

This article address: http://www.cnblogs.com/egger/archive/2013/04/26/3045975.html welcome reprint, please keep this link ๑ ́₃ ̀๑.

MONGDB Official website: http://www.mongodb.org/

Database Download Address: http://www.mongodb.org/downloads installing MongoDB

Installing MongoDB generally refers to building the core data server MongoDB. MongoDB can be a single server, a master-slave node, a member of a replica set, or a slice. This is usually the MONGODB process you need. version

MongoDB version Number (X.Y.Z): Even version is stable version, odd is the development version. The initial version of the development branch is very unstable (x.y.0, X.Y.L, x.y.2), but when the branch enters the x.y.5, it is very close to the level that can be used for production. Environment installation under Window

Select the appropriate version of the installation package according to your environment. Do not consider the production environment, just study. The following will select the WINDOW-64 bit, version 2.4.3 version.

Unzip the downloaded file to any directory. I'm a D:\NoSQL\mongodb-win32-x86_64-2.4.3 here. There is a bin folder under this directory.

Open a command prompt (Cmd.exe). Go to the Bin directory of the directory where MongoDB unzipped, that is, D:\NoSQL\mongodb-win32-x86_64-2.4.3\bin, and then perform mongod.exe (or mongod) to install it by line.

The console output has the error "Error:dbpath (\data\db\) does not exist." The \data\db\ file path does not exist.

MongoDB to create a directory for storing database files. Windows uses C:\DATA\DB as the data directory by default. However, during the installation process, files or folders will not be created automatically, and you will need to create them yourself. Of course we can also create the file directory anywhere in the system, and then use the command--dbpath to set the data directory.

Mongod--dbpath  Path

Set up the Data folder under the mongodb-win32-x86_64-2.4.3 directory, then set up the DB folder in the Data folder and start MongoDB using the instructions above in the console:

D:\nosql\mongodb-win32-x86_64-2.4.3\bin>mongod--dbpath D:\NoSQL\mongodb-win32-x86_64-2.4.3\data\db

When you see this line "Waiting for connections on port 27017", enter the address "localhost:27017" in the browser, OK.

Page English meaning: MongoDB default listening on port 27017. It also launches a very basic HTTP server, listening to a port with a number 1000 higher than the port number, or 28017 getting the management information of the database.

Mongod--help See all options

CTRL + C to stop Mongod running as a service installation

MongoDB can also be installed as a service in Windows. This allows you to start and close MONGO through the Control Panel-Administrative Tools-services.

Use the full path to run, ignore all the spaces and use the--install option to install (--logpath must be set).

Mongod-dbpath "D:\NoSQL\mongodb-win32-x86_64-2.4.3\data\db"  --logpath "D:\NoSQL\mongodb-win32-x86_64-2.4.3\ Data\log\mongodb.log "  

To start a service using "net Start service Name":

Note Using the console to start MongoDB and allow local services to conflict can only start one at a time.

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.