当前位置:网站首页>Redis cluster setup (Windows)
Redis cluster setup (Windows)
2022-07-25 05:08:00 【Hunan's last tenderness】
Redis High availability
Generally speaking , Data modification and write delete operations will consume a lot of resources , And the operation of query consumes relatively small resources , But the query operation will be more frequent than the addition, deletion and modification , So we can use clustering to help us achieve Redis High availability , Here are two very common ways to implement , They are master-slave replication and sentinel mode .
Master slave copy
First of all, we are right redis Operate on the configuration file , We need to make the port number of our primary node different from that of other nodes . Otherwise, it will happen redis Start second retreat . We turn on redis Directory folder for , Will be one of the 
This is redis To start the default configuration file, we need to configure the following file . We will 6379 Master node .
Copy this folder . Copy two copies as slave nodes . We use the master node to write and change If it is a query operation, it will hit the slave node .
Let's change the port numbers of the other two Change it to 6380 6381 As a slave node . then Link with the server Input
slaveof 127.0.0.1 6379 It means to recognize the Lord Think of this node as master The other one uses the same operation . This completes the construction of a simple master-slave mode .
We input at the client of the master node set a 6
In the slave node get To this a Value however We Try changing this value It is found that the slave node cannot modify the value .
Sentinel mode
First, let's think about why we need sentinel mode ?
When our master-slave replicates the slave node g When it's time , Our master node can still complete the function of the slave node ,, We can increase the number of slave nodes later to reduce the pressure of these nodes , however , If it's the master node g What about it ? Then the whole cluster will hang up , therefore We need a solution when the primary node is gone ,redis Sentinel mode is used .
Sentinel mode uses several other redis Server to monitor the running redis colony , It will also monitor these sentinels . When our master node g After that , The Sentinels will vote , Elect a new master node , Then attach other slave nodes to the master node , The original master node becomes offline .
How to achieve ?
First, the previous redis Don't worry about the master-slave replication mode We just need to build three new sentinels to monitor them , We are redis Create a new config
Content
# This is Redis6379 Configure the content , Add other files in the same way, and then change the port ,26380, and 26381.
# At present Sentinel The port on which the service runs
port 26380
# The main server the sentry listens to
sentinel monitor mymaster 127.0.0.1 6381 2
# 3s Inside mymaster No response , Think mymaster It's down.
sentinel down-after-milliseconds mymaster 3000
# If 10 Seconds later ,mysater It still hasn't started , Start up failover
sentinel failover-timeout mymaster 10000
# When performing a failover , At most 1 Two slave servers synchronize the new master server at the same time
sentinel config-epoch mymaster 1
Then start Because our master node contains information about other slave nodes , So our Sentry can also monitor those slave nodes , Here, you only need to configure the master node .
So sentinel mode is activated .
边栏推荐
- Implementation of recommendation system collaborative filtering in spark
- Introduction to kubernetes
- An article takes you to understand the sentinel mode of redis
- 300. Longest increasing subsequence
- Druid connection pool - strong self-study from 0. Those who don't understand Druid can click in. If you know not to click in, you will think I'm wordy
- [live review] AI customer service "changes according to the situation", and man-machine dialogue can be easier
- How to test data in the process of data warehouse migration?
- How to judge whether it is attacked by DDoS
- Tiny-emitter.js: a small event subscription and Publishing Library
- 【微信小程序】拍卖商品详情页设计与交互实现(包含倒计时、实时更新出价)
猜你喜欢

Your technical leader doesn't understand this? Without it, there is no complete thinking process of design

一篇文章带你读懂Redis的哨兵模式

Openworm project compilation

How to ensure data consistency between MySQL and redis?

Teach you how to locate unreasonable SQL? And optimize it

Style transfer -- CCPL: contrast coherence preserving loss for versatile style transfer

龙蜥社区发布首个 Anolis OS 安全指南 为用户业务系统保驾护航
[email protected]研发效能度量指标"/>学习记录[email protected]研发效能度量指标
![[literature notes] pointmlp](/img/8f/654dc6e2f4770b7f12aab49098d3d7.png)
[literature notes] pointmlp

Token value replacement of burpsuite blasting
随机推荐
Li Kou 731. My schedule II
龙蜥社区发布首个 Anolis OS 安全指南 为用户业务系统保驾护航
MCU experiment record
Docker builds MySQL master-slave replication
Small case of data analysis: visualize recruitment data and view the most needed technologies in the field~
DOM processing in ahooks
Oracle split branches
Bypass XSS filters in Web Applications
Most of the time, it's probability
956. Highest billboard pressure DP
Novel capture practice
In depth understanding of service
Summary and Prospect of aut, the transport layer protocol of sound network -- dev for dev column
When developing or debugging the IP direct scheme, it should be noted that the host value should be consistent with the direct IP
unity 3D物体添加 点击事件
Zhongchuang computing power won the recognition of "2022 technology-based small and medium-sized enterprises"
How to test data in the process of data warehouse migration?
Etcd learning
Pychart configuration pyqt5
AUTOSAR from getting started to mastering 100 lectures (105) - protection mechanism of AUTOSAR timing for functional safety