当前位置:网站首页>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 .
边栏推荐
- Data Lake (16): structured streaming writes iceberg in real time
- 【微信小程序】拍卖商品详情页设计与交互实现(包含倒计时、实时更新出价)
- The market is right
- [wechat applet] label (86/100)
- epoll的实现原理
- Information System Project Manager --- Chapter IX examination questions of project human resource management over the years
- Unity LOD
- Luogu p2391 snow covered problem solution
- 2022-7-15 summary
- Introduction to kubernetes
猜你喜欢

If you don't know these 20 classic redis interview questions, don't go to the interview!

小红书携手HMS Core,畅玩高清视界,种草美好生活

推荐系统-协同过滤在Spark中的实现

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

When we talk about immutable infrastructure, what are we talking about

Leetcode55. Jumping game

This low code reporting tool is needed for data analysis

Pychart configuration pyqt5

rhcsa暑假第三天

It we media shows off its wealth in a high profile, and is targeted by hacker organizations. It is bound to be imprisoned
随机推荐
Summary and Prospect of aut, the transport layer protocol of sound network -- dev for dev column
MCU experiment record
Performance Optimization: lazy loading of pictures
Xiaohongshu joins hands with HMS core to enjoy HD vision and grow grass for a better life
AUTOSAR from getting started to mastering 100 lectures (105) - protection mechanism of AUTOSAR timing for functional safety
harbor安装
教你如何定位不合理的SQL?并优化之
Implementation of recommendation system collaborative filtering in spark
[literature notes] pointmlp
If you don't know these 20 classic redis interview questions, don't go to the interview!
epoll的实现原理
Idea2021 installation
Analysis of lottery winning numbers in history
Json.tojsonstring cannot pass Boolean
2、 Mysql database foundation
956. Highest billboard pressure DP
nacos中哪边有这个列的sql脚本啊?
STM32 Development Notes 118: using CMSIS DSP Library in stm32cube IDE
使用getifaddrs获取本机网口IP地址
QT download installation tutorial