MongoDB Learning Notes (I.) MongoDB Introduction and installation Method _ server Other

Source: Internet
Author: User
Tags arrays failover mongodb

First, the preface

Recently began to learn the MongoDB database, but in the blog Park can not find a comparative system of tutorials, a lot of information to go to the English site, the efficiency is relatively low. I am not, by the opportunity to self-study experience are recorded to facilitate the interest of children's shoes sharing discussions. Some resources from other blogs, the purpose of the scattered knowledge points together, if there is infringement of your rights, please contact li-pan2@163.com. Most of the content is original, you are welcome to reprint share, but reproduced at the same time do not forget to mention the author and the original link oh.

Ii. introduction of MongoDB

MongoDB is a high-performance, open source, modeless document database, is the current NoSQL database is a more popular one. It can be used to replace traditional relational database or key/value storage in many scenarios. MONGO uses C + + development. MONGO's official website address is: http://www.mongodb.org/, where readers can get more detailed information.

Episode: What is NoSQL?

NOSQL, the full name is not just SQL, refers to the database of non relational type. The next generation database mainly solves several main points: non-relational, distributed, open source, level scalable. The original purpose was for large-scale Web applications, which began in the early 2009, with typical features such as free mode, support for easy replication, simple APIs, final consistency (non-acid), bulk data, and so on. NoSQL is the most used Key-value storage, of course, there are other document-type, column storage, graph database, XML database and so on.

Characteristics:

High-performance, easy to deploy, easy to use, storage data is very convenient. The main functional characteristics are:

• Set-oriented storage for easy storage of object-type data.
• Model Freedom.
• Support dynamic queries.
• Supports full indexing, containing internal objects.
• Support Queries.
• Support for replication and recovery.
• Use efficient binary data storage, including large objects such as video.
• Automatically process fragmentation to support cloud level scalability
• Supports Python,php,ruby,java,c,c#,javascript,perl and C + + language drivers, and the community also provides drivers for Erlang and. NET platforms.
• The file storage format is Bson (an extension of JSON).
• Accessible over the network.

Function:

• Collection-oriented storage: suitable for storing objects and JSON-style data.
• Dynamic query: MONGO supports rich query expressions. Query directives use JSON-form tags to easily query objects and arrays that are embedded in the document.
• Full index support: Includes document inline objects and arrays. The MONGO query optimizer analyzes the query expression and generates an efficient query plan.
• Query monitoring: MONGO contains a monitoring tool for analyzing the performance of database operations.
• Replication and automatic failover: The MONGO database supports data replication between servers, supporting master-from-mode and server replication. The primary goal of replication is to provide redundancy and automatic failover.
• Efficient traditional storage: support for binary data and large objects (such as photos or pictures)
• Automatic fragmentation to support cloud-level scalability: automatic fragmentation supports a level of database clustering that can dynamically add additional machines.

Applicable occasions:

• Site data: MONGO is ideal for real-time inserts, updates, and queries, as well as the replication and high scalability required for real-time data storage on the Web site.
• Caching: Because of its high performance, MONGO is also suitable as a caching layer for the information infrastructure. After the system restarts, the persistent cache layer built by MONGO can avoid overloading the underlying data source.
• Large size, low value data: It may be expensive to store some data using a traditional relational database, before which programmers often choose traditional files for storage.
• Highly scalable scenario: MONGO is ideal for databases made up of dozens of or hundreds of servers. The MONGO roadmap already contains built-in support for the MapReduce engine.
• Storage for objects and JSON data: MONGO's Bson data format is ideal for storing and querying in a documented format.

Third, download the installation and configuration

To install the MONGO database:

The most recent version available at the time of publishing this article is: 1.6.5, if you do not make a special statement, the version used in this tutorial will be this version.

1. The first step: Download the installation package: The official download address ← Click here, if the win system, note that the 64-bit or 32-bit version, please select the correct version.
2. The second step: Create a new directory "D:\MongoDB", unzip the download to the installation package, find the bin directory all the. exe file, copy to the directory just created.
3. Step three: Create a new "data" folder in the "D:\MongoDB" directory, which will be used as the root folder for data storage.
Configure the MONGO service side:

Open the cmd window and enter the command as follows:
> D:
> CD D:\MongoDB
> Mongod--dbpath D:\MongoDB\data

When the configuration is successful, you will see the following screen:



in Browser input: http://localhost:27017/, You can see the following tip:
You are trying to access MongoDB on the native driver port. For HTTP diagnostic access, add 1000 to the port number

, the MongoDB database service has started successfully.

Four, PostScript

Now we have the initial implementation of MongoDB installation and service start-up work. We still have a lot of work to do, to make MongoDB in our C # code can be manipulated, but also need to drive, often have friends in the online copy code found that the compiler does not pass, it is estimated that the driver is inconsistent, the next article will be explained in detail, not to be continued.

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.