当前位置:网站首页>Redis cluster
Redis cluster
2022-07-06 09:14:00 【~Pompeii】
Catalog
Redis And cluster colony
1. Cluster introduction
Cluster is to use the network to connect several computers , And provide a unified way of Management , Make it present the service effect of single machine
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-FgyN9deS-1656679467436)(C:/Users/86158/AppData/Roaming/Typora/typora-user-images/image-20220701195734260.png)]](/img/0d/c395482956e236363d659619740f51.png)
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-Fkj7gDkj-1656679467437)(C:/Users/86158/AppData/Roaming/Typora/typora-user-images/image-20220701195820347.png)]](/img/1e/a87e9fda3b277a1506a74efe4d89a1.png)
2. Cluster function
1. Disperse the access pressure of a single server , Load balancing
2. Disperse the storage pressure of a single server , Achieve scalability
3. Reduce the business disaster caused by single server downtime
3. Cluster data storage design
%16384 It's modular operation
If you add another server , Or a server suddenly goes down , What do I do ?
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-hhZAyE1t-1656679467438)(C:/Users/86158/AppData/Roaming/Typora/typora-user-images/image-20220701195945626.png)]](/img/89/7ec94297b9783e6b5acd8668c67e40.png)
37 The small box is called ” Slot “
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-u7mgz9Pk-1656679467438)(C:/Users/86158/AppData/Roaming/Typora/typora-user-images/image-20220701200237166.png)]](/img/b3/877d37fe4dd72beeb6787f7d01e381.png)
If you add another server now , Or a server suddenly goes down , What do I do ?
The following example is 3 Servers , Another server has been added , Turned into 4 individual , Then each of the other three servers takes out a part key To the new server , To optimize .
The so-called adding nodes and removing nodes actually change the location of the slot
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-INs7krGq-1656679467438)(C:/Users/86158/AppData/Roaming/Typora/typora-user-images/image-20220701201006967.png)]](/img/b3/b261db44aa574a3c78e687dd263e0d.png)
4. The design of communication within the cluster
1. Now there are clients to access the database , Conduct key Lookup ,key After being calculated by two algorithms , obtain key Location of the corresponding storage slot , Suppose the result of the calculation is A Inside 35 Slot No , If one hit, it will return directly , If you miss ,35 Slot number will be based on this key Search for , Tell the client that it is B In that slot , The client will go again B Find the slot inside ( Be careful : No A Go find , Is the client to find , Avoid clients from going to other places for many times and looking for them one by one )
2. You can hit it twice at most
Be careful : The number of slots in each database is not necessarily continuous , It's scattered
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-JkqhRdyG-1656679467439)(C:/Users/86158/AppData/Roaming/Typora/typora-user-images/image-20220701201427295.png)]](/img/df/5111ab12c813a494c6abf8db509359.png)
5. Cluster building method
1. Native installation ( Single command )
1) Configure server (3 Lord 3 from )
2) Establish communication (Meet)
3) Slotting (Slot)
4) Build master slave (master-slave)
2. Tool installation ( The batch )
6.cluster To configure
1.cluster-enabled yes|no
Add the server as a node
2.cluster-config-file
cluster Profile name , This file is automatically generated .
If we give you a name , Will automatically generate the specified name cluster-config-file ;
If we don't give you a name , A default name will be automatically generated cluster-config-file ;
give an example :cluster-config-file nodes-6379.conf
And it's only used to quickly find files .
( notes : We try to assign a name , Because it is generated by default in the case of a large number of nodes cluster-config-file The file names are the same , Easy to confuse )
3.cluster-node-timeout
Node service response timeout , Used to determine whether the node is offline or switched to a slave node
4.cluster-migration-barrier
master Connected slave Minimum quantity
7.cluster Node operation command
1. View the cluster node information
cluster nodes
2. Enter a slave node redis, Switch its master node
cluster replicate <master-id>
3. Find a new node , Add master node
cluster meet ip:port
4. Ignore one without solt The node of
cluster forget <id>
5. Manual failover
cluster failover
8.redis-trib command
redis-trib Equivalent to a script , hold cluster Some of the commands are optimized , In practice cluster Own command or redis-trib Everything can be ordered
1. Add a node
redis-trib.rb add-node
2. Delete node
redis-trib.rb del-node
3. The shard
redis-trib.rb reshard
边栏推荐
- Advanced Computer Network Review(3)——BBR
- After reading the programmer's story, I can't help covering my chest...
- 五层网络体系结构
- AcWing 2456. Notepad
- QML control type: menu
- Mise en œuvre de la quantification post - formation du bminf
- Improved deep embedded clustering with local structure preservation (Idec)
- [OC foundation framework] - [set array]
- I-BERT
- LeetCode:498. Diagonal traversal
猜你喜欢

Redis之性能指标、监控方式

【shell脚本】——归档文件脚本

Booking of tourism products in Gansu quadrupled: "green horse" became popular, and one room of B & B around Gansu museum was hard to find

KDD 2022 paper collection (under continuous update)

Heap (priority queue) topic

【文本生成】论文合集推荐丨 斯坦福研究者引入时间控制方法 长文本生成更流畅

Multivariate cluster analysis

Redis之Bitmap

postman之参数化详解

Redis之主从复制
随机推荐
Selenium+pytest automated test framework practice (Part 2)
Reids之删除策略
Leetcode: Sword finger offer 48 The longest substring without repeated characters
Intel distiller Toolkit - Quantitative implementation 2
Intel Distiller工具包-量化实现3
CSP salary calculation
Using label template to solve the problem of malicious input by users
AcWing 2456. Notepad
[oc foundation framework] - < copy object copy >
LeetCode:162. Looking for peak
Reids之缓存预热、雪崩、穿透
[today in history] February 13: the father of transistors was born The 20th anniversary of net; Agile software development manifesto was born
【剑指offer】序列化二叉树
The carousel component of ant design calls prev and next methods in TS (typescript) environment
Advanced Computer Network Review(4)——Congestion Control of MPTCP
Philosophical enlightenment from single point to distributed
Pytest's collection use case rules and running specified use cases
Intel Distiller工具包-量化实现2
Redis之性能指标、监控方式
AcWing 2456. 记事本