当前位置:网站首页>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 )
边栏推荐
- Parameterization of postman
- Leetcode: Sword finger offer 48 The longest substring without repeated characters
- Opencv+dlib realizes "matching" glasses for Mona Lisa
- Advanced Computer Network Review(4)——Congestion Control of MPTCP
- Intel Distiller工具包-量化实现2
- Redis之Geospatial
- CUDA实现focal_loss
- Ijcai2022 collection of papers (continuously updated)
- Selenium+pytest automated test framework practice (Part 2)
- Chapter 1 :Application of Artificial intelligence in Drug Design:Opportunity and Challenges
猜你喜欢

Chapter 1 :Application of Artificial intelligence in Drug Design:Opportunity and Challenges

CUDA implementation of self defined convolution attention operator
![[OC]-<UI入门>--常用控件-提示对话框 And 等待提示器(圈)](/img/af/a44c2845c254e4f48abde013344c2b.png)
[OC]-<UI入门>--常用控件-提示对话框 And 等待提示器(圈)

KDD 2022 paper collection (under continuous update)

Alibaba cloud server mining virus solution (practiced)

The carousel component of ant design calls prev and next methods in TS (typescript) environment

I-BERT
![[MySQL] multi table query](/img/eb/9d54df9a5c6aef44e35c7a63b286a6.jpg)
[MySQL] multi table query

Nacos 的安装与服务的注册

SimCLR:NLP中的对比学习
随机推荐
Reids之删除策略
随手记01
LeetCode:26. Remove duplicates from an ordered array
LeetCode:498. 对角线遍历
Advanced Computer Network Review(4)——Congestion Control of MPTCP
Booking of tourism products in Gansu quadrupled: "green horse" became popular, and one room of B & B around Gansu museum was hard to find
Leetcode: Sword Finger offer 42. Somme maximale des sous - tableaux consécutifs
KDD 2022 paper collection (under continuous update)
CSP salary calculation
UML diagram memory skills
Digital people anchor 618 sign language with goods, convenient for 27.8 million people with hearing impairment
SAP ui5 date type sap ui. model. type. Analysis of the parsing format of date
[OC foundation framework] - [set array]
Nacos installation and service registration
Reids之缓存预热、雪崩、穿透
[oc]- < getting started with UI> -- learning common controls
BN折叠及其量化
[today in history] February 13: the father of transistors was born The 20th anniversary of net; Agile software development manifesto was born
[OC-Foundation框架]--<Copy对象复制>
LeetCode:39. Combined sum