当前位置:网站首页>Redis uses sentinel master-slave switching. What should the program do?
Redis uses sentinel master-slave switching. What should the program do?
2022-06-28 07:55:00 【star++】
summary
The sentry passed the surveillance master, If you find that master Failed to reply to heartbeat package , Then it will be judged as subjective offline , The Sentinels who voted more than half believed that master Subjective offline , Then confirm as master Objective offline , Then one of the Sentinels will be selected as leader, To do master Switch jobs . Switched the new master, Notify the client to connect to the new master. So here comes the question , How does the program know about the new master What's the address ? Do you need to make any changes in the application ?
Introduce dependencies
//springboot Project integration redis
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
Increase the configuration
//1. Configuration is no longer directly configured redis Node address , Instead, configure the sentinel address
//2.master Offline judgment , And choose a new master The sentry is the clearest , So just keep communicating with the sentry
//3. It is still directly used in the program RedisTemplate
spring:
redis:
// Sentinel configuration
sentinel:
边栏推荐
- Study notes 22/1/17
- kubelet驱逐机制的源码分析
- Section 5: zynq interrupt
- Generation and verification of JWT token
- Redis one master multi slave cluster setup
- Rediscluster cluster mode capacity expansion node
- Ambari (VII) --- ambari integrated hue4.2 document (valid for personal test)
- ACM notes
- 8 figures | analyze Eureka's first synchronization registry
- How to insert a single quotation mark into a table as a data type in Oracle pl/sql
猜你喜欢
Section Xi. Axi of zynq_ Use of DMA
Application of XOR. (extract the rightmost 1 in the number, which is often used in interviews)
Soft exam -- software designer -- afternoon question data flow diagram DFD
Kubelet garbage collection (exiting containers and unused images) source code analysis
Section 5: zynq interrupt
flex布局
【js】-【DFS、BFS应用】-学习笔记
ZYNQ_ IIC read / write m24m01 record board status
Kubernetes理论基础
LeetCode之三步问题
随机推荐
"Three routines" of digital collection market
[thanos source code analysis series]thanos query component source code analysis
MySQL installation and environment variable configuration
Cloud native: cloud computing technology is upgraded again to open an era of comprehensive cloud development
22/02/15 study notes
Section VI UART of zynq
Is it reliable to open an account by digging money? Is it safe?
8 figures | analyze Eureka's first synchronization registry
Co process, asyncio, asynchronous programming
How to insert a single quotation mark into a table as a data type in Oracle pl/sql
【js】-【DFS、BFS应用】-学习笔记
HJ delete the character with the least number of occurrences in the string
asp. Net datalist to display product information and pictures
HJ prime factor
Dataset filling data, and the use of rows and columns
XML serialization backward compatible
Hj21 simple password
Kubernetes theoretical basis
Study notes 22/1/17
Design and implementation of spark offline development framework