Take you to understand NoSQL


NOsql overview

NoSQL database (Not Only SQL ), NoSQL, generally refers to non-relational databases.

One: Why use Nosql? ?

1. The era of stand-alone MySQL

mark

In the 1990s, a basic website was generally not visited too much, and a single database was completely sufficient!

At that time, it was more to use static web pages html ~ the server did not have much pressure at all

Think about it, in this case: What is the bottleneck of the entire website?

1、数据量如果太大,一个机器放不了!

2、数据的索引 单表超过300万就一定要建立索引

(B+ Tree),一个机器内存也放不下

3、访问量(读写混合),一个服务器承受不了~

As long as you start to experience one of the above three situations, then you must advance!

2. Memcache (cache) + MySQL + vertical split (read-write separation)

80% of the website is reading, and it is very troublesome to query the database every time! So we hope to use caching to ensure efficiency!

Development process: Optimize data structure and index-"File Cache (IO)-"Memcache (the hottest technology at the time)

mark

3. Sub-database sub-table + horizontal split + MySQL cluster

With the development of technology and business, the requirements for people are getting higher and higher!

Essence: database (read, write)

MyISAM in the early years: table locks. Greatly affect efficiency! Serious lock problems will occur under high concurrency

Switch to lnnodb: row lock

Slowly start using the sub-database and sub-table to solve the pressure of writing! When did MySQL introduce table partitioning! Not many companies use this!

The MySQL cluster satisfies all the needs of that era well!

mark

4. Today's recent era

During the ten years from 2010 to 2020, the world has undergone earth-shaking changes; (status is also a kind of data, music, hot list, etc.!)

Relational databases such as MySQL are not enough! There is a lot of data, and it changes quickly~!

Some people use MySQL to store some relatively large files, blogs, and pictures! The database table is very large, the efficiency is low! If there is a special kind of database

, MySQL pressure becomes very small (study how to deal with these problems!) Under the IO pressure of big data, the table is almost no bigger than if!

5. A basic Internet project at present!

mark

6. Why use NoSQL!

User's personal information, social network, geographic location. The data generated by users themselves, user logs, etc. have exploded!

At this time, we need to use NoSQL database, MolSQL can handle the above situation very well!

Two: What is NoSQL

NoSQL = Not Only SQL (不仅仅是SQL)

Relational database: tables, rows, columns

Refers to the amount of non-relational databases, with the birth of the web2.0 Internet! Traditional relational databases are difficult to deal with the web2.0 era! Especially large-scale high-concurrency communities! Many insurmountable problems are exposed. NoSQL is developing very rapidly in today's big data environment. Redis is the fastest growing and a technology that must be mastered now!

Many data types include personal information, social networks, and address locations of users. The storage of these data types does not require a fixed format! You can scale horizontally without requiring months of operation! Map<Sting, Objet> uses key-value pairs to control!

2.1: NoSQL features

1. Easy to expand (there is no relationship between data, it's easy to expand!)

2. Large amount of data and high performance (Redis can write 80,000 times and read 110,000 per second. NoSQL cache records are a fine-grained cache, and the performance will be relatively high!)

3. The data types are diverse! (No need to implement a design database! Use it as you go! If it is a table with a very large amount of data, many people cannot design it!)

4. Traditional RDBMS and NoSQL

传统的 rRDBMS
-结构化组织
-SQL
-数据和关系都存在单独的表中
-操作操作,数据定义语言
-严格的一致性
-基础的事务
-......
NOsql
-不仅仅是数据
-没有固定的查询语言
-键值对存储,列存储,文档存储,图形数据库(社交关系)
-最终一致性
-CAP定理和BASE (异地多活)初级架构师
-高性能、高可用,高可扩

2.2: Understanding: 3v+3 high

大数据时代的3v:主要描述问题

1.海里Volume

2.多样Variety

3.实时Velocity 5G

大数据时代的3高:主要对程序的要求

1.高并发

2.高可扩(随时水平拆分,机器不够了,可以扩展机器来解决)

3.高性能(保证用户体验跟性能) 

在公司中的实践:NoSQL + RDBMS 一起使用才是最强的

Three: Four categories of NoSQL

1 Key-value database

相关产品:Redis、Riak、SimpleDB、Chordless、Scalaris、Memcached

应用:内容缓存

优点:扩展性好、灵活性好、大量写操作时性能高

缺点:无法存储结构化信息、条件查询效率较低

使用者:百度云(Redis)、GitHub(Riak)、BestBuy(Riak)、Twitter(Ridis和Memcached)

2 Document database

相关产品:MongoDB、CouchDB、ThruDB、CloudKit、Perservere、Jackrabbit

应用:存储、索引并管理面向文档的数据或者类似的半结构化数据

优点:性能好、灵活性高、复杂性低、数据结构灵活

缺点:缺乏统一的查询语言

使用者:百度云数据库(MongoDB)、SAP(MongoDB)

3 column family data

相关产品:BigTable、HBase、Cassandra、HadoopDB、GreenPlum、PNUTS

应用:分布式数据存储与管理

优点:查找速度快、可扩展性强、容易进行分布式扩展、复杂性低

使用者:Ebay(Cassandra)、Instagram(Cassandra)、NASA(Cassandra)、Facebook(HBase)

4 Graph database

相关产品:Neo4J、OrientDB、InfoGrid、GraphDB

应用:大量复杂、互连接、低结构化的图结构场合,如社交网络、推荐系统等

优点:灵活性高、支持复杂的图形算法、可用于构建复杂的关系图谱

缺点:复杂性高、只能支持一定的数据规模

使用者:Adobe(Neo4J)、Cisco(Neo4J)、T-Mobile(Neo4J)

eo4J、OrientDB、InfoGrid、GraphDB

应用:大量复杂、互连接、低结构化的图结构场合,如社交网络、推荐系统等

优点:灵活性高、支持复杂的图形算法、可用于构建复杂的关系图谱

缺点:复杂性高、只能支持一定的数据规模

使用者:Adobe(Neo4J)、Cisco(Neo4J)、T-Mobile(Neo4J)

Guess you like

Origin blog.csdn.net/weixin_47151643/article/details/108505412