当前位置:网站首页>NoSQL mongodb - 01 introduction to NoSQL and mongodb
NoSQL mongodb - 01 introduction to NoSQL and mongodb
2022-06-26 12:34:00 【Preserved egg is very white】
NoSQL brief introduction
Reference resources :NoSQL brief introduction
Problems with relational databases
2008 About years ago , Website 、 Forum 、 Social networks have started to develop at a high speed , Traditional relational database It is a great challenge to store and process data , It is mainly reflected in the following points :
It is difficult to cope with tens of thousands of highly concurrent data writes per second .
The speed of querying hundreds of millions of data is slow .
sub-treasury 、 It is difficult to further expand the sub database formed by tables after reaching a certain scale .
sub-treasury 、 The rules for splitting tables may change due to changes in requirements .
It is difficult to modify the table structure .
In many Internet application scenarios , The query demand for the data join table is not so strong , It does not need to be read immediately after the data is written , But there are very high requirements for the speed of data reading and concurrent writing .
In the era of data explosion , If you want to use the traditional relational database to meet the high concurrency of data reading and writing 、 Storage of huge amounts of data 、 Database expansion and high availability , You need to increase the specifications of software and hardware , This will significantly increase costs .
In this case , Non relational database Get rapid development .
What is? NoSQL database
RDB(Relational Database): Relational database .
NoSQL(NoSQL = Not Only SQL), meaning “ not only SQL”, It is also called non relational database (non-relational).
Non relational Is to put the data directly into a big warehouse , No label 、 Do not connect 、 Simply pile it up , Thus, the requirements for high-performance storage and access of massive data are improved .
Traditional databases are burdened by various relationships , Constraints of various data forms , It is difficult to handle massive data and highly concurrent business scenarios .
In order to solve the above problems , You must have a self defeating martial art , In order to break through the bottleneck of the database system at a higher level , for example MongoDB, It can only cope with... By abandoning its inherent patterns Facebook Hundreds of millions of bits of massive data .
If you've only touched relational databases before , Such as Oracle、Mysql or SQL Server, I'm learning MongoDB You may feel uneasy , Suddenly there is a database that does not support foreign keys , Unsupported transaction , Data type conventions are not supported , It makes people feel useless .
On modern computing systems , A huge amount of data is generated on the network every day , A lot of this data is managed by RDBMS (RDBMS:Relational Database Manangement System) To deal with it .
1970 year E.F.Codd’s The paper that put forward the relation model “A relational model of data for large shared data banks”, This makes data modeling and application programming easier .
It is proved by practice that , The relational model is very suitable for client server programming , Far more than expected , Today it is the leading technology of structured data storage in network and business applications .
NoSQL Is a new database revolutionary movement , In the early days, someone put forward , To 2009 The annual trend is rising .NoSQL Advocates of non relational data storage , Relative to the overwhelming use of relational databases , There is no doubt that this concept is a brand new injection of thinking .
NoSQL classification
Key value database
This kind of database mainly uses the key in the data structure Key To find specific data Value.
advantage : Do not use any mode when storing , So it's easy to add data .
This kind of database has very high read and write performance , A high access load for processing large amounts of data is appropriate .
The key value database is suitable for high access and write load scenarios of large amounts of data , For example, the logging system .
The main representatives are Redis、Flare.
Document database
This kind of database meets the storage and access needs of massive data , At the same time, the field requirements are not strict , You can add as you like 、 Delete 、 Modify fields , And there is no need to define the table structure in advance , So it is suitable for all kinds of network applications .
The main representatives are MongoDB、CouchDB.
Document databases are very similar to relational databases .
Column storage database
The main representatives are Hbase、Cassandra.
This kind of database is fast to find , High scalability , Suitable for distributed file storage system .
Graph database
The main representatives are InfoGrid、Neo4J.
Such databases use ” The graph structure “ To store the relationship information between entities , A relationship map suitable for building social networks and recommendation systems .
NoSQL And RDB How to choose
since NoSQL There are so many databases , Can it directly replace the relational database ?
NoSQL It can not completely replace the relational database ,NoSQL It is mainly used to deal with the storage and operation of large and multivariate data . Under such characteristic differences , How do we choose the right database to solve the problem of data storage and processing ?
Here are the following points as the basis for judgment :
1、 The relevance requirements of the data model
NoSQL It is suitable for applications with low model relevance , therefore :
If you need multi table Association , be RDB More suitable for
If the object entity association is less , be NoSQL Database is more suitable for
- among MongoDB It can support data structures with relatively high complexity , The ability to embed the associated data in a document , So as to reduce the correlation operation between data
2、 Performance requirements of database
If there is a large amount of data and access speed is critical , So use NoSQL Database may be appropriate .NoSQL The database can greatly improve the storage performance through the distributed storage of data .
3、 Data consistency requirements
NoSQL Databases have one drawback : It does not match in transaction processing and consistency RDB par .
therefore ,NoSQL It is difficult for a database to satisfy both strong consistency and high concurrency .
If the application has high performance requirements , be NoSQL The database can only achieve the final consistency of data .
4、 Data availability requirements
Considering that the unavailability of data may cause risks ,NoSQL Database provides powerful data availability ( In some applications that require quick feedback to users , Response latency is also considered a degree of high availability ).
A project does not select only one database , It can be disassembled for design , Will need RDB The characteristics of RDB In the management , Other data is put into NoSQL In the management .
MongoDB brief introduction
Reference resources :MongoDB brief introduction
What is? MongoDB
Official documents :https://www.mongodb.com.
MongoDB By C++ language-written , Is an open source based on distributed file storage NoSQL Database system .
MongoDB Is a product between relational and non-relational databases , Non-relational databases are the most versatile , Most like a relational database . This will make it easier for people who have used relational databases .
MongoDB Store data as a document , Data structure consists of key value pairs (key=>value) form .
MongoDB The document is BSON(Binary Serialized Document Format Binary serialized document format ) Format , Similar to JSON object , Field values can contain other documents 、 Arrays and document arrays .

MongoDB The query function of is very powerful :
It not only supports single tables in most relational databases ( aggregate ) Inquire about , It also supports range query 、 Sort 、 polymerization 、MapReduce etc.
MongoDB The query syntax of is similar to the object-oriented programming language
MongoDB The development history
2007 year 10 month ,MongoDB from 10gen Team development
2009 year 2 For the first time this month 1.0 edition
2011 year 9 Published in 2.0 edition , Fragmentation 、 Copy and other functions
2015 year 3 Published in 3.0 edition ,WiredTiger Storage engine support
2018 year 6 Published in 4.0 edition , Introduction ACID Transaction support , Be the first to support strong affairs NoSQL database
…
MongoDB What scenarios apply
1、 Need to deal with a large number of low value data , It also has high requirements for data processing performance
So-called Low value Even if the data is lost, it will not have much impact .
such as , Banking transaction system belongs to high-value data .
such as , The processing of microblog data does not need to be too transactional , But there are high requirements for data access performance , This is very suitable for use MongoDB.
2、 Need to use the cache layer to process data
because MongoDB Can process data efficiently , So it is very suitable to be used as a cache layer . take MongoDB As a persistent cache layer , It can avoid the resource overload of the underlying storage .
For example, after the user logs in session Session information is stored in MongoDB in .
3、 Requires a high degree of scalability
For relational databases , When the size of the table reaches a certain order of magnitude , Its performance will decline dramatically . At this time, multiple can be used MongoDB The server builds a cluster environment , Achieve maximum expansion , And it doesn't affect performance .
边栏推荐
- 手把手带你学会Odoo OWL组件开发(7):OWL项目实战使用
- Spark-day01- get started quickly
- KITTI Detection dataset whose format is letf_top_right_bottom to JDE normalied xc_yc_w_h
- Learning directory
- 2021 q3-q4 investigation report on the use status of kotlin multiplatform
- Lodash common methods (filtering, anti shake...)
- 7-2 大盗阿福
- [solved] data duplication or data loss after laravel paginate() paging
- The most complete kubernetes core command of the latest version so far
- Deep thinking from senior member managers
猜你喜欢

This executeQuery (SQL) cannot compile classes for JSP. What is the reason?

JS get the current screen height method and listen for DOM elements to enter the viewport

11、 Box styles and user interface
![[solved] data duplication or data loss after laravel paginate() paging](/img/68/7bf51bbf893a91bee24f5f7d4a369f.jpg)
[solved] data duplication or data loss after laravel paginate() paging

【概率论】条件概率、贝叶斯公式、相关系数、中心极限定理、参数估计、假设检验

Deep thinking from senior member managers

Installing MySQL under Linux (RPM package installation)

Several methods added to the ES6 array (foreach, filter, some, every. Includes, reduce)

dried food! Yiwen will show you SD card, TF card and SIM card!

New routing file in laravel framework
随机推荐
我想知道,股票开户有哪些优惠活动?网上开户是否安全么?
"Pinduoduo and short video speed version", how can I roast!
JS how to judge when data contains integer and floating-point types. Floating-point decimals retain two digits after the decimal point
Comparison of latest mobile phone processors in 2020 (with mobile phone CPU ladder diagram)
The laravel dingo API returns a custom error message
7-2 大盗阿福
[graduation season · advanced technology Er] I remember the year after graduation
小程序中控件里面的内容较多,让其支持滚动的良好方案
PHP generate order number
TP5 thinkphp5 report serialization of'closure'is not allowed
MS17_ 010 utilization summary
NFS shared storage service installation
Current situation investigation and investment prospect forecast analysis report of China's electrolytic copper market from 2022 to 2028
[solved] laravel completes the scheduled job task (delayed distribution task) [execute a user-defined task at a specified time]
Assembly language (7) operation instruction
I want to know whether flush is a stock market? Is online account opening safe?
Nodejs framework express and KOA
Scala-day02- variables and data types
New routing file in laravel framework
Redis cannot connect to the server through port 6379