当前位置:网站首页>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:边栏推荐
- Installing redis on Linux
- LeetCode之三步问题
- Configuring MySQL multi instance master-slave synchronization for Linux
- What is EC blower fan?
- Block transmission by golang gin framework
- Kubelet garbage collection (exiting containers and unused images) source code analysis
- The solution of "user account control to continue, please enter administrator user name and password" appears in win10 Professional Edition
- [thanos source code analysis series]thanos query component source code analysis
- Path alias specified in vite2.9
- Is it safe to open an account on Dongfang fortune
猜你喜欢

Resizing node of rediscluster cluster cluster mode

Software testing and quality final review

Recommended system series (Lecture 5): Optimization Practice of sorting model

云原生:云计算技术再次升级 开启全面云开发时代

Leetcode learning records

Source code analysis of kubernetes' process of deleting pod
![[ thanos源码分析系列 ]thanos query组件源码简析](/img/e4/2a87ef0d5cee0cc1c1e1b91b6fd4af.png)
[ thanos源码分析系列 ]thanos query组件源码简析

Unity-UI-shadow组件

ACM notes

Online WPS tool
随机推荐
Ambari (VII) --- ambari integrated hue4.2 document (valid for personal test)
GoLand IDE and delve debug Go programs in kubernetes cluster
SQL Master slave Replication Build
Study notes 22/1/17
MMR rearrangement (similarity is calculated by editing distance and repeatability)
Unity-UI-shadow组件
Localization SoC development plan
Section 5: zynq interrupt
HJ整数与IP地址间的转换
8 张图 | 剖析 Eureka 的首次同步注册表
At 19:00 on Tuesday evening, the 8th live broadcast of battle code Pioneer - how to participate in openharmony's open source contribution in multiple directions
Study notes 22/1/19 and 22/1/20
kubelet驱逐机制的源码分析
数字藏品市场“三大套路”
flex布局
"Three routines" of digital collection market
8 figures | analyze Eureka's first synchronization registry
Hash slot of rediscluster cluster cluster implementation principle
逆波兰表达式求值<难度系数>
卸载重装最新版mysql数据库亲测有效