当前位置:网站首页>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 .
边栏推荐
- Luogu p4281 [ahoi2008] emergency gathering / gathering solution
- STM32 Development Notes 118: using CMSIS DSP Library in stm32cube IDE
- [analysis of GPIO register (crl/crh) configuration of STM32]
- 推荐系统-协同过滤在Spark中的实现
- Performance Optimization: how to solve the slow loading speed of the first screen of spa single page application?
- Why does the official not recommend using UUID as MySQL primary key
- Androd releases jitpack open source project (gradle7.2)
- Render Optimization: repaint and reflow
- Three must know and know problems of redis
- Unity LOD
猜你喜欢

Execution process of NPM run XX

Web: compiling big refactoring from 10 to 1
![[CTF learning] steganography set in CTF -- picture steganography](/img/32/2da78bd5866cfab9ee64dfcb1c1204.png)
[CTF learning] steganography set in CTF -- picture steganography

Go language function

GDT,LDT,GDTR,LDTR
Set up private CA server

MCU experiment record

PyG搭建GCN实现链接预测

Redis的三个必知必会的问题

ES6 -- Methods and extensions of array objects, traversal of arrays, and extension methods of strings
随机推荐
[the most comprehensive and detailed] how to design a database and table splitting scheme that can dynamically expand and shrink capacity?
Document collaboration tool recommendation
Introduction to CpG control network
I will write some Q & A blogs recently, mainly focusing on the points that are easy to have doubts.
Wechat official account all article download links to get
Use getifaddrs to obtain the IP address of the local network interface
Leetcode55. Jumping game
Implementation principle of epoll
Docker builds MySQL master-slave replication
STM32 development note 120: solve the problem that%f in printf cannot be output
85 distributed project construction
[wechat applet] label (86/100)
HMS Core Discovery第16期直播预告|与虎墩一起,玩转AI新“声”态
服务器防护的七个建议
The second day of rhcsa summer vacation
推荐系统-协同过滤在Spark中的实现
2022-7-18 summary
2022-7-13 summary
Idea2021 installation
Ffmpeg download and installation