当前位置:网站首页>Redis 高可用
Redis 高可用
2022-08-04 14:50:00 【kk_02】
Redis的主从复制实现高可用
主从复制架构
- 主从架构,一个主节点,两个从节点
- 通过手动监控的方式,监控master的宕机,以及出现故障将故障转移的方式可以做到高可用
- 缺点:手动监控
Redis哨兵模式策略
- 自动进行故障转移
- 1.多个sentinel 发现并确认master有问题。
- 2.sentinel内部选举领导
- 3.选举出slave作为新的master
- 4.通知其余的slave成为新master的slave
- 5.通知客户端 主从变化
- 6.如果老的master重新复活,那么成为新的master的slave
Redis-Cluster策略
分布存储机制-槽
(1)redis-cluster 把所有的物理节点映射到[0-16383]slot 上,cluster 负责维护
(2)Redis 集群中内置了 16384 个哈希槽,当需要在 Redis 集群中放置一个 key-value 时,redis 先
对 key 使用 crc16 算法算出一个结果,然后把结果对 16384 求余数,这样每个key 都会对应一个编号在
0-16383 之间的哈希槽,redis 会根据节点数量大致均等的将哈希槽映射到不同的节点。
三个节点:槽分布的值如下:
SERVER1: 0-5460
SERVER2: 5461-10922
SERVER3: 10923-16383
容错机制-投票
(1)选举过程是集群中所有master参与,如果半数以上master节点与故障节点通信超时,认为该节点故障,
自动触发故障转移操作. 故障节点对应的从节点自动升级为主节点
(2)什么时候整个集群不可用(cluster_state:fail)?
如果集群任意master挂掉,且当前master没有slave.集群进入fail状态,也可以理解成集群的slot映射
[0-16383]不完成时进入fail状态.
总结
1.主从复制是高可用一种策略
2.哨兵解决了手动故障转移
3.redis-cluster解决了哨兵不能最大化利用内存、木桶效应,同时支持横向扩容
边栏推荐
- Next -20- 使用自定义样式 (custom style)
- 用于X射线聚焦的复合折射透镜
- This week to discuss the user experience: Daedalus Nemo to join Ambire, explore the encryption of the ocean
- 本周讨论用户体验:Daedalus 的 Nemo 加入 Ambire,探索加密海洋
- [Opportunity Enlightenment-60]: "Soldiers, Stupid Ways"-1- Opening: "Death" and "Life" are the way of heaven
- Sum of four squares, laser bombs
- 微软表示将向内部网络安全专家共享数据 为企业提供更安全保护
- 四平方和,激光炸弹
- [Problem solving] QT update component appears "To continue this operation, at least one valid and enabled repository is required"
- 华为云 & 达达,帮有情人“一键送达”
猜你喜欢
Almost all known protein structures in the world are open sourced by DeepMind
LeetCode_模拟_中等_498.对角线遍历
实际工作中的高级技术(训练加速、推理加速、深度学习自适应、对抗神经网络)
I/O stream summary
广告电商系统开发功能只订单处理
Technology sharing | Mini program realizes audio and video calls
直播系统开发——直播间架构的设计及难点分析
leetcode:241. 为运算表达式设计优先级
并发程序的隐藏杀手——假共享(False Sharing)
CloudCompare&PCL 点云按网格划分(点云分幅)
随机推荐
leetcode:251. 展开二维向量
Find My技术|防止你的宠物跑丢,苹果Find My技术可以帮到你
leetcode: 250. Count subtrees of equal value
7 天能找到 Go 工作吗?学学 Go 数组和指针试试
没有Project Facets的解决方法
C# 将dll打包到程序中
Resharper 如何把类里的类移动到其他文件
[Beiya data recovery] IBM System Storage storage lvm information lost data recovery solution
Technology sharing | Description of the electronic fence function in the integrated dispatching system
Phasecraft连下两城,助力英国量子技术商业化加速!
CF1527D MEX Tree(mex&树&容斥)
How to automatically renew the token after it expires?
[Problem solving] QT update component appears "To continue this operation, at least one valid and enabled repository is required"
数据库恢复
ping的原理
C# SolidWorks二次开发---工程图简单版标注孔信息
分布式链路追踪Jaeger + 微服务Pig在Rainbond上的实践分享
程序猿七夕礼物-如何30分钟给女朋友快速搭建专属语聊房
饿了么智能头盔专利获授权,进一步提升骑手安全保障
LeetCode_模拟_中等_498.对角线遍历