01Redis-NoSql Getting Started Overview

content

1. Overview of Nosql

Why use Nosql

What is Nosql

Nosql Features

Understand: 3V + 3 High

Second, the four categories of Nosql

KV key-value pair

Document database (bson data format):

column store database

Graph relational database


  • nosql explanation
  • nosql data model
  • Four categories of Nosql
  • CAP
  • BASE
  • Getting Started with Redis
  • Redis installation (Window & Linux server)
  • Five basic data types.
    • I squeeze
    • List
    • Set
    • Hash
    • Zset
  • Three special data types
    • geo
    • hyperloglog 
    • bitmap
  • Detailed Redis configuration
  • Redis persistence  [core]
    • RDB
    • AOF
  • Redis transaction operations
  • Redis implements subscription publishing (message queue)
  • Redis master-slave replication
  • Redis sentinel mode (cluster)
  • Cache penetration and solutions
  • Cache Breakdown and Solutions
  • Cache Avalanche and Solutions
  • Detailed explanation of Jedis of basic API
  • SpringBoot integrates Redis
  • Practical analysis of operating Redis

1. Overview of Nosql

Why use Nosql

1. The era of stand-alone Mysql

insert image description here

In the 1990s, the traffic of a website was generally not too large, and a single database was completely sufficient. With the increase of users, the website has the following problems

  1. When the amount of data increases to a certain extent, the stand-alone database cannot be placed
  2. The index of the data (B+ Tree) cannot be stored in a single machine memory
  3. When the number of visits increases (mixed read and write), a server cannot bear it.

2. Memcached (cache) + Mysql + vertical split (read and write separation)

80% of the situation on the website is reading, it is very troublesome to query the database every time! So we want to reduce the pressure on the database, we can use the cache to ensure efficiency!

insert image description here

The optimization process has gone through the following steps:

  1. Optimize the data structure and index of the database (difficult)
  2. File cache, obtaining through IO stream is slightly more efficient than accessing the database every time, but when the traffic explodes, the IO stream can't bear it.
  3. MemCache, the most popular technology at that time, by adding a layer of cache between the database and the database access layer, the database is queried for the first access, and the results are saved in the cache, and subsequent queries will first check the cache, and use it directly if there is any. , the efficiency is significantly improved.

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

insert image description here

4. The most recent era

Nowadays, the amount of information is growing explosively, and various data (user positioning data, picture data, etc.) appear. In the context of big data, relational databases (RDBMS) cannot meet the requirements of large amounts of data. Nosql database can easily solve these problems.

Currently a basic Internet project

insert image description here

Why use NoSQL?

User's personal information, social network, geographic location. User-generated data, user logs, etc. exploded!
At this time, we need to use NoSQL database, Nosql can handle the above situation very well!

What is Nosql

NoSQL = Not Only SQL

Not Only Structured Query Language

Relational database: column + row, the structure of data under the same table is the same.

Non-relational database: The data store has no fixed format and can be scaled horizontally.

NoSQL generally refers to non-relational databases. With the birth of the web2.0 Internet, it is difficult for traditional relational databases to deal with the web2.0 era! Especially the ultra-large-scale and high-concurrency community exposes many insurmountable problems. NoSQL is developing very rapidly in today's big data environment, and Redis is the fastest growing.

Nosql Features

  1. Easy to expand (there is no relationship between data, it is easy to expand!)
  2. Large data volume and high performance (Redis can write 80,000 times and read 110,000 times per second. The NoSQL cache record level is a fine-grained cache, and the performance will be relatively high!)
  3. Data types are diverse! (No need to design the database in advance, just take it and use it)
  4. Traditional RDBMS and NoSQL
传统的 RDBMS(关系型数据库)
- 结构化组织
- SQL
- 数据和关系都存在单独的表中 row col
- 操作,数据定义语言
- 严格的一致性
- 基础的事务
- ...
Nosql
- 不仅仅是数据
- 没有固定的查询语言
- 键值对存储,列存储,文档存储,图形数据库(社交关系)
- 最终一致性
- CAP定理和BASE
- 高性能,高可用,高扩展
- ...

Understand: 3V + 3 High

3V in the era of big data: mainly to describe the problem

  1. Massive Velume
  2. Variety
  3. Real-time Velocity

Three highs in the era of big data: mainly the requirements for programs

  1. High concurrency
  2. Highly scalable
  3. high performance

Real practice in the company: NoSQL + RDBMS together is the strongest.

# 商品信息
- 一般存放在关系型数据库:Mysql,阿里巴巴使用的Mysql都是经过内部改动的。

# 商品描述、评论(文字居多)
- 文档型数据库:MongoDB

# 图片
- 分布式文件系统 FastDFS
- 淘宝:TFS
- Google: GFS
- Hadoop: HDFS
- 阿里云: oss

# 商品关键字 用于搜索
- 搜索引擎:solr,elasticsearch
- 阿里:Isearch 多隆

# 商品热门的波段信息
- 内存数据库:Redis,Memcache

# 商品交易,外部支付接口
- 第三方应用

The technology behind a simple web page must not be as simple as imagined

Second, the four categories of Nosql

KV key-value pair

  • Sina: Redis
  • Meituan: Redis + Tair
  • Ali, Baidu: Redis + Memcache

Document database (bson data format):

  • MongoDB (Master)
    • Database based on distributed file storage. Written in C++ for handling large volumes of documents.
    • MongoDB is an intermediate product between RDBMS and NoSQL. MongoDB is the most feature-rich non-relational database and the most relational database in NoSQL.
  • ConthDB

column store database

  • HBase (must learn for big data)
  • Distributed file system

Graph relational database

For ad recommendation, social network

  • Neo4j、InfoGrid

Four comparisons

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324053098&siteId=291194637