当前位置:网站首页>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
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 ?
37 The small box is called ” Slot “
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
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
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
边栏推荐
- QDialog
- Mise en œuvre de la quantification post - formation du bminf
- LeetCode:41. Missing first positive number
- How to intercept the string correctly (for example, intercepting the stock in operation by applying the error information)
- 五层网络体系结构
- LeetCode:498. Diagonal traversal
- UML图记忆技巧
- Nacos 的安装与服务的注册
- The carousel component of ant design calls prev and next methods in TS (typescript) environment
- [oc]- < getting started with UI> -- common controls uibutton
猜你喜欢
After reading the programmer's story, I can't help covering my chest...
I-BERT
[OC foundation framework] - string and date and time >
[three storage methods of graph] just use adjacency matrix to go out
Detailed explanation of dynamic planning
Redis之哨兵模式
Post training quantification of bminf
An article takes you to understand the working principle of selenium in detail
Redis之Bitmap
Reids之删除策略
随机推荐
不同的数据驱动代码执行相同的测试场景
After reading the programmer's story, I can't help covering my chest...
[OC-Foundation框架]---【集合数组】
requests的深入刨析及封装调用
[today in history] February 13: the father of transistors was born The 20th anniversary of net; Agile software development manifesto was born
【每日一题】搬运工 (DFS / DP)
A convolution substitution of attention mechanism
使用标签模板解决用户恶意输入的问题
Intel distiller Toolkit - Quantitative implementation 2
Blue Bridge Cup_ Single chip microcomputer_ PWM output
Redis之性能指标、监控方式
[OC foundation framework] - string and date and time >
Using C language to complete a simple calculator (function pointer array and callback function)
The carousel component of ant design calls prev and next methods in TS (typescript) environment
[shell script] - archive file script
如何正确截取字符串(例:应用报错信息截取入库操作)
Advanced Computer Network Review(3)——BBR
Basic usage of xargs command
Advanced Computer Network Review(4)——Congestion Control of MPTCP
An article takes you to understand the working principle of selenium in detail