当前位置:网站首页>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 )
边栏推荐
- [OC]-<UI入门>--常用控件-提示对话框 And 等待提示器(圈)
- Cesium draw points, lines, and faces
- 使用latex导出IEEE文献格式
- Connexion d'initialisation pour go redis
- Redis之五大基础数据结构深入、应用场景
- MYSQL卸载方法与安装方法
- LeetCode:498. 对角线遍历
- Intel Distiller工具包-量化实现3
- Improved deep embedded clustering with local structure preservation (Idec)
- Pytest参数化你不知道的一些使用技巧 /你不知道的pytest
猜你喜欢
Chapter 1 :Application of Artificial intelligence in Drug Design:Opportunity and Challenges
KDD 2022 paper collection (under continuous update)
Mathematical modeling 2004b question (transmission problem)
[oc]- < getting started with UI> -- common controls uibutton
Nacos 的安装与服务的注册
I-BERT
ant-design的走马灯(Carousel)组件在TS(typescript)环境中调用prev以及next方法
Advanced Computer Network Review(4)——Congestion Control of MPTCP
数字人主播618手语带货,便捷2780万名听障人士
[OC]-<UI入门>--常用控件-UIButton
随机推荐
[sword finger offer] serialized binary tree
甘肃旅游产品预订增四倍:“绿马”走红,甘肃博物馆周边民宿一房难求
SimCLR:NLP中的对比学习
LeetCode:498. 对角线遍历
Booking of tourism products in Gansu quadrupled: "green horse" became popular, and one room of B & B around Gansu museum was hard to find
Chapter 1 :Application of Artificial intelligence in Drug Design:Opportunity and Challenges
Parameterization of postman
LeetCode41——First Missing Positive——hashing in place & swap
How to intercept the string correctly (for example, intercepting the stock in operation by applying the error information)
In depth analysis and encapsulation call of requests
LeetCode41——First Missing Positive——hashing in place & swap
Advanced Computer Network Review(5)——COPE
Leetcode: Sword finger offer 48 The longest substring without repeated characters
Problems encountered in connecting the database of the project and their solutions
CUDA implementation of self defined convolution attention operator
Different data-driven code executes the same test scenario
requests的深入刨析及封装调用
Digital people anchor 618 sign language with goods, convenient for 27.8 million people with hearing impairment
Opencv+dlib realizes "matching" glasses for Mona Lisa
Leetcode problem solving 2.1.1