Non-relational database-Mongodb

Source: Internet
Author: User

NoSQL (non-relational database)In short, a relational model refers to a two-dimensional table model, and a relational database is a data organization composed of two-dimensional tables and their relationships. The most common interpretation of NoSQL is "non-relational", emphasizing the advantages of Key-Value Stores and document databases, rather than simply opposing RDBMS.

Non-relational database features
1. Large data volumes can be processed.
2. Run on a cheap PC server cluster. The expansion of PC clusters is very convenient and cost-effective, avoiding the complexity and cost of "sharding" operations.
3. breaks down the performance bottleneck. NoSQL advocates say that the NoSQL architecture can save the time to convert Web or Java applications and data into SQL-friendly formats, and the execution speed becomes faster.
4. There are not many operations.
5. Supporters come from the community. NoSQL projects are open-source, so they lack formal support from vendors. Like most open-source projects, they have to seek support from the community.

MongoDB IntroductionMongoDB is a product between relational databases and non-relational databases. It has the most abundant functions and features like relational databases. The supported data structure is very loose and is similar to the json bjson format. Therefore, it can store complicated data types. The biggest feature of Mongo is that it supports a very powerful query language. Its syntax is somewhat similar to an Object-Oriented Query Language. It can almost implement most of the functions similar to single-table queries in relational databases, it also supports data indexing. It is a set-oriented, free-of-charge document-type database.

MongoDB featuresCollection-oriented means that data is grouped into several sets. These sets are called collections ). each aggregation in a database has a unique name, which can contain unlimited documents. clustering is a synonym for tables in RDBMS. The difference is that clustering does not require schema definition.
The free mode means that the database does not need to know any structure information of the documents you store in the aggregation. In fact, you can store documents of different structures in the same aggregation.
Document Type, which means that the data we store is a set of key-value pairs, the key is a string, and the value can be any type in the data type set, including arrays and documents. the data format is called "[BSON]", that is, "Binary Serialized dOcument Notation."
Document-oriented storage: (JSON-like data mode is simple and powerful ).
Efficient traditional storage: supports binary data and large objects (such as photos and videos ).
Replication and automatic failover: The Mongo Database supports data replication between servers and master-slave mode and mutual replication between servers.
Auto-Sharding supports cloud-level Scalability (in the early alpha stage): the Auto-Sharding feature supports horizontal database clusters and allows you to dynamically add additional machines.
Dynamic query: it supports a variety of Query expressions. Query commands use JSON tags to easily query embedded objects and arrays in a document.
Full index support: Includes embedded object and array of documents. The Query Optimizer of Mongo analyzes the query expression and generates an efficient query plan.
Supports RUBY, PYTHON, JAVA, C ++, PHP, and other languages.
Oriented to set storage and easy to store object-type data: documents stored in the set are stored as key-value pairs. The key uniquely identifies a document, which is a string type, and the value can be a complex file type;
Free mode: the files stored in the mongodb database do not need to be aware of any structure definition;
Supports full indexing, including internal objects.
Supports replication and fault recovery.
Automatic fragment processing: the automatic fragment function supports horizontal database clusters and allows you to dynamically add additional machines.
Query monitoring: Mongo provides a monitoring tool to analyze the performance of database operations.

MongoDB installation and configurationStep 1: Download MongoDB
: Http://downloads.mongodb.org
Step 2: Set the MongoDB program storage directory
Decompress the downloaded package to D: \ and rename it to mongodb. The path is d: \ mongo.
Step 3: Set the data file storage directory
Create a folder on disk d, path d: \ mdb
Step 4: Start the MongoDB Service
Go to the cmd prompt console, go to the d: \ mongo \ bin directory, and enter the command mongod -- dbpath = d: \ mdb
Step 5: Start MongoDB randomly as a Windows Service
First create a log file: also go to d: \ mongo \ bin, enter the command mongod -- dbpath = d: \ mdb -- logpath = d: \ mdb \ logs \ mongodb. log -- install
Re-open the console window as an administrator and set mongodb Service Startup: net start mongodb
Step 6: Verify the connection

Enter d: \ mongodb \ bin \ mongo. If the following prompt is displayed, the installation is successful.



Mongodb application scenarios 1. website data: MongoDB is very suitable for real-time insertion, update, and query, as well as the replication and high scalability required for real-time website data storage.
2. cache: because of its high performance, MongoDB is also suitable for serving as a cache layer for information infrastructure. After the system is restarted
The persistence cache layer built by MongoDB can avoid data source overload at the lower layer.
3. Large-sized and low-value data: traditional relational databases may be expensive to store some data. Previously, programmers often choose traditional files for storage. For example, a large amount of audio and image storage is used in some projects.
4. high scalability: MongoDB is ideal for databases composed of dozens or hundreds of servers. The MongoDB roadmap contains built-in support for the MapReduce engine.
5. Used for object and JSON Data Storage: The BSON data format of MongoDB is suitable for storing and querying document-based data.

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.