当前位置:网站首页>[redis foundation] understand redis master-slave architecture, sentinel mode and cluster together (Demo detailed explanation)
[redis foundation] understand redis master-slave architecture, sentinel mode and cluster together (Demo detailed explanation)
2022-07-03 15:55:00 【Chen Xi should work hard】
【 Chen Xi has to work hard 】:hello Hello, I'm Chen Xi , I'm glad you came to read , Nickname is the hope that you can constantly improve , Moving forward to good programmers !
The blog comes from the project and the summary of the problems encountered in programming , Occasionally there are books to share , I'll keep updating Java front end 、 backstage 、 database 、 Project cases and other related knowledge points summary , Thank you for your reading and attention , I hope my blog can help more people , Share and gain new knowledge , Make progress together !
We quarryers , The heart of a cathedral , May we go in our own love …
One 、 Master slave architecture
In this issue, I will study with you Redis Master slave architecture 、 Sentinel mode 、 Basic concepts related to clusters !
Master slave synchronization :Master After the node receives the write request and processes it , Need to inform Slave The node data has changed , The behavior of keeping the data of master-slave nodes consistent is called master-slave synchronization
Read / write separation : stay redis In the master-slave architecture ,Master The node is responsible for processing write requests ,Slave The node only processes read requests . Fewer write requests , Scenarios with many read requests
One master, many followers : Structure optimization
If there are many slave nodes , To ease the master-slave replication storm ( Multiple slave nodes copy the master node at the same time, which leads to excessive pressure on the master node ), You can do the following Architecture , Let part of the slave node and slave node ( Synchronize with the master node ) Synchronous data
If the Lord master Hang up ?
If an instance master Hang up , We need to manually switch one from the server to the main server , It will also make the service unavailable for a period of time .
In order to solve the problem that the master-slave mode cannot be highly available , He invented the sentinel mode
Two 、 Sentinel mode
What is a sentry
1、sentinel Sentinels are special redis service , No read-write service , It's mainly used to monitor redis Instance node .
2、 Sentinel mode is a special mode ,Redis The order of the sentry , Sentinels are an independent process , As a process , It will run on its own . The sentry sent orders , wait for Redis Server response , So as to monitor the operation of multiple Redis example .
The main role of the sentry
1、 By sending commands , Give Way Redis The server returns to monitor its running state , Including the master and slave servers .
2、 When the Sentinels detect master Downtime , Will automatically slave Switch to master, Then the other slave servers are informed through publish subscribe mode , Modify the configuration file , Let them switch hosts .
When redis The master node of the , The Sentinels will be aware of , And the new redis The master node notifies client End ( Inside this redis Of client The end generally implements the subscription function , subscribe sentinel Published node change message )
Sentinel mode , Must be based on redis Done in master-slave replication mode
summary : Sentinel mode , It is based on the original master-slave architecture , Another cluster , The sentry cluster , This cluster will monitor redis The status of the master and slave nodes of the cluster , If you find that the primary node is hung , One of the slave nodes will be selected as the master node again , So as to achieve high availability .
3、 ... and 、 Cluster pattern
Redis Cluster interpretation
Redis Cluster is a distributed server group composed of multiple master-slave nodes , It has replication 、 High availability and fragmentation features .
Redis Cluster architecture
Redis3.0 before : Configuration instructions
1、 stay redis3.0 In previous versions, clusters were implemented with the help of sentinels sentinel Tools to monitor master The state of the node
2、 If master Node exception , Then we will switch from the master to the slave , Take a certain one slave As master, The sentry configuration is a little complicated , And performance and high availability and other aspects of the general performance
3、 Especially in the moment of master-slave switching, there is an access transient , And the sentinel mode only has one master node to provide external services , Can't support very high concurrency , And the memory of a single primary node should not be set too large , Otherwise, the persistent file will be too large , Affect the efficiency of data recovery or master-slave synchronization
Redis colony : Unwanted sentinel sentry
1、Redis Clusters do not need sentinel sentry , It can also complete the function of node removal and fail over .
2、 You need to set each node to cluster mode , There is no central node in this cluster mode , Scalable horizontally , According to official documents, it can be linearly extended to tens of thousands of nodes ( The official recommendation is no more than 1000 Nodes ).
3、redis Cluster performance and high availability are better than the previous version of sentinel mode , And the cluster configuration is very simple
Basis of this period Redis Master slave architecture 、 Sentinel mode 、 Cluster graphic explanation , Later, it will be updated one after another , See you next time ……
Thank you very much for reading here , If this article helps you , I hope I can leave your praise Focus on ️ Share Leaving a message. thanks!!!
2021 year 11 month 26 Japan 22:42:21 May we go in our love !
边栏推荐
- Shell script import and export data
- Go language self-study series | golang switch statement
- 嵌入式开发:避免开源软件的7个理由
- 【OpenCV 例程200篇】217. 鼠标交互获取多边形区域(ROI)
- 从 flask 服务端代码自动生成客户端代码 -- flask-native-stubs 库介绍
- WinDbg analysis dump file
- Detailed explanation of four modes of distributed transaction (Seata)
- Tensorflow realizes verification code recognition (III)
- 阿飞的期望
- Win10 enterprise 2016 long term service activation tutorial
猜你喜欢
App移动端测试【4】apk的操纵
CString getbuffer and releasebuffer instructions
Unity function - unity offline document download and use
[system safety] 43 PowerShell malicious code detection series (5) automatic extraction of ten thousand words from abstract syntax tree
String functions that you need to know
Nifi from introduction to practice (nanny level tutorial) - flow
Q2 encryption market investment and financing report in 2022: gamefi becomes an investment keyword
Summary of JVM knowledge points
Visual upper system design and development (Halcon WinForm) -1 Process node design
Microservice - Nacos registration center and configuration center
随机推荐
Seckill system 3- product list and product details
Microservice - Nacos registration center and configuration center
Summary of JVM knowledge points
Calibre LVL
Win32 create window and button (lightweight)
CString在多线程中的问题
Tensorflow realizes verification code recognition (I)
Large CSV split and merge
秒杀系统1-登录功能
Function introduction of JMeter thread group
A Fei's expectation
VC下Unicode和ANSI互转,CStringW和std::string互转
软件逆向破解入门系列(1)—xdbg32/64的常见配置及功能窗口
Wechat payment -jsapi: code implementation (payment asynchronous callback, Chinese parameter solution)
Brush questions -- sword finger offer
子类隐藏父类的同名函数
Download and install common programs using AUR
首发!!lancet饿了么官方文档
Redis高可用与持久化
Popular understanding of decision tree ID3