I. The download, installation and deployment of MongoDB

Source: Internet
Author: User
Tags create mongodb mongodb client mongodb commands

1. What is MongoDB?

It is a NoSQL database between relational database and non-relational database, written in C + +, is a high-performance document-oriented universal database which integrates agility, scalability and extensibility.

2. Why use MongoDB?

It has some of the following characteristics:

A) flexible document data Model

It is very easy to store data of different structure, and also can modify the source structure mode of the data dynamically.

b), Scalable extensibility

From a single server to thousands of nodes, MongoDB can easily scale horizontally and deploy multiple data centers

c), Level two index

Includes indexes, geospatial, Text Search, and TTL indexes on any field that are fully consistent, enabling fast, granular access to data

d), rich query language

MongoDB's query language provides a variety of field-level operators, data types, and instant updates. Almost all programming language drivers are available to make it more intuitive to use.

e), robust operating tools

MongoDB's management services and operations management tools make it easy to deploy, monitor, backup, and plan it

3. When to use MongoDB?

Here are a few use cases:

A), the need to write large amounts of data, but the value of these data is not too high, such as: Log

b), data growth is large, and the structure is sometimes inconsistent

c), the future data will be very large

4. MongoDB Installation and Deployment

: http://www.mongodb.org/downloads, note there are 32-bit and 64-bit points, 32 of the database maximum capacity cannot exceed 2gb!

The blogger system is a Win8.1 64-bit system, so here is the installation and deployment of MongoDB with the latest version (3.03) as an example of this system!

A), download the 64-bit MSI installation file and double-click to install it.

Ⅰ, direct next into the next step:

Ⅱ, tick "I accept ...", you know, Next:

Ⅲ, the first option: Complete (full version), the default installation of all features to C drive; the second option custom (custom), you can choose to install directories and services. Here we choose Custom:

Ⅳ, default full feature installation, select Browse to replace the installation directory to F:\MongoDB (own selection,) Next, then select Install to start the installation:

Ⅴ, Installation Complete!

Ⅶ, open the Bin folder under the MongoDB directory, you will see a lot of exe executable files, briefly introduced under:

b), start deployment:

Ⅰ, first we create a new DB folder under the installation directory (F:\MongoDB) as the database storage path, and then use the server-side file as the database directory!

Win+r, enter cmd, enter the DOS command window, and then use the CD command to enter the F:\mongodb:\bin directory, execute the following command:

F:\mongodb\bin>mongod.exe--dbpath F:\MongoDB\db

Will output server-side related information, including version, database location, listening port number, database size and so on, see this note you have succeeded,

or enter in the browser: http://localhost:27017/, you will see the following passage,

It looks like you is trying to access MongoDB over HTTP on the native driver port.

"Trying to link MongoDB with HTTP on a local drive port" can also indicate that you have successfully configured the server!

Ⅱ, start the MongoDB client into the shell,

After the server has been configured successfully, we do not close this Server DOS window, otherwise it is unable to connect!

We open another command window, enter into the F:\mongodb:\bin, enter the Mongo.exe command to connect to the database,

See this note that the client has successfully connected to the server, then you can use a variety of MONGODB commands in the shell!!

If the server does not open, there will be an error that cannot be connected as follows:

c), add MongoDB service to the system

At this point, then someone will say, I can not always use the client to maintain a Server DOS window open it? The answer is certainly not!

Let's try adding a MongoDB service:

Ⅰ, we create a new log folder in the F:\MongoDB directory to hold the log file, and then the key win+x+a to open the Administrator command prompt.

Ⅱ, use the following command to create the configuration file mongod.cfg:

C:\windows\system32>echo logpath=f:\mongodb\log\mongod.log> "F:\MongoDB\mongod.cfg"

C:\windows\system32>echo dbpath=f:\mongodb\db>> "F:\MongoDB\mongod.cfg"

Ⅲ, OK, the preparation is done, the next most important step is to create a MongoDB service using the SC command:

C:\windows\system32>sc.exe Create MongoDB binpath= "F:\MongoDB\bin\mongod.exe--service--config=f:\mongodb\ Mongod.cfg "

The following creation service success prompt appears:

                    

Ⅳ, open service:

Use the following command: C:\windows\system32>net start MongoDB to open MongoDB service! See this statement that you have succeeded,

Then Win+r, enter services.msc to open the list of Windows services, and you will see a service named MongoDB with a status of "Running",

So far you can start MongoDB from the service and then use its service without having to keep another DOS window on the server!

Ⅴ, shutting down services and deleting services

Close the service using the following command:

C:\windows\system32>net Stop MongoDB

The Delete service uses the following command:

C:\windows\system32>sc.exe Delete MongoDB

I. The download, installation and deployment of 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.