当前位置:网站首页>[redis] ① introduction and installation of redis
[redis] ① introduction and installation of redis
2022-07-26 00:21:00 【Zhangguoqing (Qing Yi)】
List of articles
zero 、 Database classification
(1) Relational database
Relational database uses form ( Row and column ) To store data
- MySQL
- Oracle
- SqlServer
- DB2
Relational database supports SQL92 standard
Relational database Business Aspects are stronger than non relational databases
(2) Non relational database (NoSQL)
Not Relational database Do not use forms To store data
① key-value Type non relational database
A specific key ( The pointer ) Point to given The data of
- Tokyo Cabinet/Tyrant
- Redis
- Voldemort
- Oracle BDB
② Column store database
The column storage database is used to deal with Distributed storage A huge amount of data
A key points to Multiple Columns of data
- Cassandra
- HBase
- Riak
Relational database (MySQL) Storage 500 Million data performance , Column store database (HBase)1 Billion data performance impact is very small
③ Document database
Document database It can be seen as Key value database Upgraded version ( Nested key values are allowed )
The data model stored in a document database is similar JSON
The query efficiency of document database is higher than that of key value database High query efficiency
- CouchDB
- MongoDB
- SequoiaDB
④ Graphic database
The database with graphic structure is flexible Graphic model , Can store similar 【 Friend relationship 】 The data of
- Neo4J
⑤ Features of non relational database ( When to use non relational databases )
- The data model is simple
- Need more flexible application systems
- High requirements for database performance
- No need for high data consistency
- For a given key Environments that can easily map complex values
One 、Redis What is it? ?
(1) Redis Introduce
Redis is the open source, in-memory data store used by millions of developers as a database, cache, streaming engine, and message broker.
Redis Used by millions of developers database 、 cache 、 Stream engine and message broker .
Remote Dictionary Server( Remote Dictionary Service ), Is an open source use ANSI C Language writing 、 Support network 、 Can be based on memory persistent log type 、Key-Value database , And provide multilingual API.
(2) Redis characteristic
- Fast : Reading data 11w/s; Writing data 8w/s
- Provide rich data types :String、List、Set、Zset、Hash
- Persistence mechanism
- High availability
- Distributed
(3) Who is using Redis?
- github
- blizzard
- stackoverflow
- flickr
- Sina weibo ( The world's largest Redis colony )
- TaoBao
(4) Redis Learning network
Redis Get started online :http://try.redis.io/
Redis Chinese data station :http://www.redis.cn/
github:https://github.com/antirez/redis
Redis Official website :https://redis.io/
Redis Command Reference :http://redisdoc.com/
Two 、Redis install
(1) install gcc
Redis It's using C language-written . stay Linux install Redis front , First you want to install gcc(C Language compiler )
yum -y install gcc automake autoconf libtool make

(2) download 、 decompression 、 compile 、 install Redis
① download :
yum install wget
wget http://download.redis.io/releases/redis-5.0.8.tar.gz

② decompression :
tar -zxvf redis-5.0.8.tar.gz -C /devzgq/

In the picture above redis-5.0.8 Catalog , perform make Catalog ( compile redis Program )
③ compile :
make

④ install :
make PREFIX=/usr/local/redis-5.0.8 install
After installation, the corresponding execution script will be generated to the specified directory bin Below directory 
(3) start-up Redis The order of
① Get into redis5.0.8 In the catalog bin Catalog
② Start the service
Use it directly 【./redis-server】 The front desk starts

Use dynamic parameters 【./redis-server --port=6380】
Use the configuration file to start ( recommend )
③ Client access :【./redis-cli】
redis-cli -h IP Address -p port
Exit client ctrl + C
4.PING command
(4) Redis Of bin Commands in the directory
redis-server【 start-up redis service 】
redis-cli【redis Client connection 】
redis-check-aof【 Check aof】
redis-check-rdb【 Check rdb Backup 】
redis-benchmark【redis Performance testing 】
redis-sentinel【 start-up redis The sentinel mechanism of 】
(5) Redis Configuration file for


【 Background start 】daemonize yes
【 Configure remote login 】bind 0.0.0.0
【 port configuration 】port 6379
【 working directory 】dir /devzgq/redis-5.0.8/data
【 Log files 】logfile “6379.log”(6379.log The file in data Under the table of contents )
【 Password configuration 】requirepass zgqredis
(6) close Redis
closed :
Inquire about PID:ps -ef |grep redis-server
kill -9 PID
redis-cli.sh shutdown
./redis-cli -a zgqyyes shutdown【 Use password to close 】
redis-cli.sh -p port -h host 【 The default connection is local 6379 port 】
Scattered concept
(1) Extension type
Massive data stored on the same server is under great pressure , We need to consider expanding it
- Horizontal expansion : Add master server or slave server
- Vertical expansion : Add memory or hard disk directly to the main server
(2) High availability
- A master-slave mode : There is a master server , Multiple slave servers . If the main server goes down , App cannot provide service
- Sentinel form (Redis2.x): Based on the master-slave mode , A machine will act as a sentry , To monitor the status of other machines . When the primary node goes down , It elects between slave nodes , Look at the performance of that machine . Upgrade the high-performance slave node to the master node , To achieve high availability . When the master node is repaired , Will automatically join the ranks of slave nodes
- Cluster pattern (Redis3.0): Have multiple masters and multiple slaves . If a primary node goes down , The slave node below it will be elected as the master node
Avoid single point of failure
Increase throughput
Increase data storage capacity
(3) Data reliability
Restart the server after power failure , Data can be recovered
Redis There are two ways to do persistence :
- RDB: Periodically synchronize the data in the memory to the hard disk of the machine
- AOF: Will put the inside DML The operation is written to a log , After power failure, you can know what you have done before from the log
边栏推荐
- mysql事务的四大特性以及隔离级别
- MySQL 索引使用有哪些注意事项呢?(从六个方面回答)
- 没错,请求DNS服务器还可以使用UDP协议
- Unified handling of global exceptions
- Backtracking - 17. Letter combinations of phone numbers
- Recent impressions about bull market and defi 2021-05-17
- 解决不挂载数据的页面刷新
- 白蛋白纳米粒表面修饰低分子量鱼精蛋白LMWP/PEG-1900修饰牛血清白蛋白制备研究
- This time, thoroughly understand promise principle
- 【目录】mqtt、nodejs项目
猜你喜欢

MySQL——数据库日志

The way of understanding JS: what is prototype chain

基于网络分析和文本挖掘的意见领袖影响力研究

How to use 120 lines of code to realize an interactive and complete drag and drop upload component?

Nest. JS uses express but not completely

"Demons dance", is the bull market over? 2021-05-13

基于SEIR模型的网络医疗众筹传播建模与仿真分析

12.神经网络模型

NVIDIA programmable reasoning accelerator tensorrt learning notes (III) -- Accelerating reasoning

Binary tree -- 104. Maximum depth of binary tree
随机推荐
"Animal coin" is fierce, trap or opportunity? 2021-05-12
The bull market is not over yet, and there is still 2021-05-18 in the second half
MWEC:一种基于多语义词向量的中文新词发现方法
12.神经网络模型
Old laptop becomes server (laptop + intranet penetration)
NVIDIA programmable reasoning accelerator tensorrt learning notes (III) -- Accelerating reasoning
12. Neural network model
IP Core: PLL
FreeRTOS个人笔记-信号量
Binary tree -- 111. Minimum depth of binary tree
Thymeleaf view integration
Backtracking - 17. Letter combinations of phone numbers
[hero planet July training leetcode problem solving daily] 25th tree array
FreeRTOS personal notes - semaphore
滑动窗口_
After using MQ message oriented middleware, I began to regret
MySQL - master-slave replication
Use of redis
CyclicBarrier
分布式事务 :可靠消息最终一致性方案
