当前位置:网站首页>Execution of commands in the cluster
Execution of commands in the cluster
2022-06-26 15:00:00 【Hua Weiyun】
redis The execution of commands in the cluster
If the client sends key commands to the nodes in the cluster , Then you only need to assign the slot with the key to the current node for processing , If it is not on the current node , Return... To the client MOVED command . This command redirects the client to the correct node , Then send the command again . In cluster mode ,MOVED The command will hide
Calculation of the slot containing the database key
CRC 16 ( secret key ) % 16384 Calculate the slot to which the key belongs . among ,CRC16 ) key Statement is used to calculate the key key Of CRC16 The checksum . The cluster key slot key lets you see which slot this key is assigned to
Storage associated with the node and slot
How does the node determine whether the slot is in its own responsibility ? Obviously through the cluster state structure slots Array , If the cluster node indicated by the slot is in cluster status myself Property value , This node is responsible for , Otherwise, based on the indicated cluster node
Key and slot associated storage
The only way to save database key value pairs in a cluster is to use 0 The database . In addition to saving key value pairs in the database , Node also passes clusterState Medium slots_to_keys Jump table to save the direct relationship between key and slot . For each node score Is the slot number , Members are the keys of the database . Whenever a node adds a key value pair to the database , The key and slot Association will be added from the jump table , When deleting key value pairs , The key and slot Association will also be deleted from the jump table . The records in this jump table allow batch operation of all database keys in the slot .
summary
This is the execution process of commands in the cluster , Client sends command , If the command about the slot is executed at the current node , Return if it is not at the current node move command , Then redirect to the node responsible for this slot , Calculation database key The slot position of is based on key Of crc16 The value of is equal to 16384 modulus ,16384 yes redis All slots , Clustered slots The element of the array executes the current node, indicating that the slot is in the charge of this node .
️ Thank you for your
If you think this is helpful for you :
- Welcome to follow me ️, give the thumbs-up , Comment on , forward
- Focus on
Panpan small class, Push good articles for you regularly , There are also group chat and irregular lottery activities , You can say what you want , Communicate with the great gods , Learning together . - If there is anything inappropriate, you are welcome to criticize and correct .
边栏推荐
- cluster addslots建立集群
- teamviewer显示设备数量上限解决方法
- Kubernetes的pod
- A remove the underline from the label
- Minister of investment of Indonesia: Hon Hai is considering establishing electric bus system and urban Internet of things in its new capital
- Attention meets geometry: geometry guided spatiotemporal attention consistency self supervised monocular depth estimation
- Kubernetes的pod调度
- MySQL master-slave replication and read-write separation
- Electron
- 工作上对金额价格类小数点的总结以及坑
猜你喜欢

在云服务器中云磁盘如何挂载

人的顶级能量从哪里获取?

NAACL2022:(代码实践)好的视觉引导促进更好的特征提取,多模态命名实体识别(附源代码下载)...

印尼投资部长:鸿海考虑在其新首都建立电动公交系统、城市物联网

710. 黑名单中的随机数

View touch analysis

人力资源导出数据 excel VBA

Mathematical modeling of war preparation 30 regression analysis 2

Mark: unity3d cannot select resources in the inspector, that is, project locking

How to mount cloud disks in ECS
随机推荐
TS common data types summary
R language uses GLM function to build Poisson logarithm linear regression model, processes three-dimensional contingency table data to build saturation model, uses step function to realize stepwise re
券商经理给的开户二维码安全吗?找谁可以开户啊?
How to mount cloud disks in ECS
Mathematical modeling of war preparation 30 regression analysis 2
聊聊 RPA 方向的规划:简单有价值的事情长期坚持做
Detailed explanation of C language programming problem: can any three sides form a triangle, output the area of the triangle and judge its type
信息学奥赛一本通 1405:质数的和与积 (思维题)
qt下多个子控件信号槽绑定方法
Extended hooks
clustermeet
Redis事务与watch指令
SAP gui 770 下载
Is it safe to open a stock account with the account manager online??
Introduction to basic knowledge of C language (Daquan) [suggestions collection]
网上找客户经理办理股票开户安全吗??
cluster addslots建立集群
【soloπ】adb连接单个多个手机
杜老师说网站更新图解
VMware partial settings