当前位置:网站首页>Redis cluster
Redis cluster
2022-07-06 09:12:00 【I hope it's not too late to wake up】
principle

be-all redis Nodes interconnect with each other (PING-PONG Mechanism )(ping For similar requests ,pong Just like the response ), Internally, binary protocols are used to optimize transmission speed and bandwidth .
Node fail It only takes effect when more than half of the nodes in the cluster are detected to have failed .
The client and redis Node is directly connected , You don't need the middle proxy layer . The client does not need to connect to all the nodes of the cluster , Connect to any of the available nodes in the cluster
redis-cluster Map all the physical nodes to [0-16383]slot On ,cluster Responsible for maintaining node<->slot( Slot )<->value
Redis There's a built-in... In the cluster 16384 Hash slot , When need is in Redis Place one in the cluster key-value when ,redis First pair key Use crc16 The algorithm works out a result , Then get the result right 16384 Mod , So each of them key They all have a number in 0-16383 The Hashi trough between ,redis The hash slot will be mapped to different nodes approximately equally according to the number of nodes .redis The benefits of clustering : Distribute the data on different nodes , Reduce the throughput of a single node , So as to improve the performance of a single node .
Vote
- The voting process is all in the cluster master Participate in (slave It's a backup , Not working , Only when the host is down , The slave of the host will be enabled ), If more than half master Node and master Node communication timeout (cluster-node-timeout), Think of the current master Node down .
- When is the entire cluster unavailable (cluster_state:fail)?
- If the cluster is arbitrary master Hang up , And the current master No, slave. Cluster into fail state , It can also be understood as a cluster slot mapping [0-16383] Enter when not finished fail state .
ps : redis-3.0.0.rc1 Join in cluster-require-full-coverage Parameters , Off by default , Failed to open the cluster compatibility section . - If more than half of the clusters master Hang up , Whether or not slave Cluster into fail state .
ps: When the cluster is not available , All operations on the cluster are not available , received ((error) CLUSTERDOWN The cluster is down) error
- If the cluster is arbitrary master Hang up , And the current master No, slave. Cluster into fail state , It can also be understood as a cluster slot mapping [0-16383] Enter when not finished fail state .

build redis colony
Cluster setup environment preparation
# install gcc Environmental Science (redis Use c Language development )
yum -y install gcc gcc-c++
# install ruby Environmental Science (redis Cluster dependency ruby)
yum -y install ruby rubygems
gem install redis-3.0.3.gem( This needs to be downloaded by yourself )( amount to redis and ruby The interface of )
# 1. Create a cluster Directory cluster-redis
# 2. stay cluster-redis establish 8 A catalog : The directory name is :7001-7008
# 3. Copy redis Stand alone service bin Directory to 7001 Catalog
# 4. modify redis service (bin Catalog )
# Modify port as 7001( Consistent with the directory name )
# Enable cluster configuration :cluster-enable yes
# Empty redis service aof,rdb Persistent files , Keep cluster nodes clean
# Copy 7001 A single machine with a modified directory redis service --- To other 7 A catalog
# Modify other 7 Ports of directories ( The port and directory name are the same )
边栏推荐
- Selenium+Pytest自动化测试框架实战(下)
- IJCAI2022论文合集(持续更新中)
- In depth analysis and encapsulation call of requests
- LeetCode:39. Combined sum
- Tdengine biweekly selection of community issues | phase III
- I-BERT
- go-redis之初始化连接
- LeetCode:劍指 Offer 42. 連續子數組的最大和
- BN折叠及其量化
- SAP ui5 date type sap ui. model. type. Analysis of the parsing format of date
猜你喜欢

Mongodb installation and basic operation

BMINF的后训练量化实现

Ijcai2022 collection of papers (continuously updated)

UML图记忆技巧

LeetCode:236. The nearest common ancestor of binary tree

MYSQL卸载方法与安装方法

Redis之五大基础数据结构深入、应用场景
![[today in history] February 13: the father of transistors was born The 20th anniversary of net; Agile software development manifesto was born](/img/70/d275009134fcbf9ae984c0f278659e.jpg)
[today in history] February 13: the father of transistors was born The 20th anniversary of net; Agile software development manifesto was born

Redis之Bitmap

Parameterization of postman
随机推荐
什么是MySQL?MySql的学习之路是怎样的
Mise en œuvre de la quantification post - formation du bminf
Reids之删除策略
Detailed explanation of dynamic planning
BN折叠及其量化
BMINF的後訓練量化實現
MYSQL卸载方法与安装方法
What is MySQL? What is the learning path of MySQL
I-BERT
QML type: locale, date
IJCAI2022论文合集(持续更新中)
LeetCode:236. The nearest common ancestor of binary tree
SimCLR:NLP中的对比学习
SAP ui5 date type sap ui. model. type. Analysis of the parsing format of date
Leetcode: Sword Finger offer 42. Somme maximale des sous - tableaux consécutifs
Selenium+pytest automated test framework practice
requests的深入刨析及封装调用
【图的三大存储方式】只会用邻接矩阵就out了
[sword finger offer] serialized binary tree
Leetcode: Jianzhi offer 04 Search in two-dimensional array