- 1
- 0
- 约1.17万字
- 约 12页
- 2025-10-23 发布于北京
- 举报
集群1:——Sentinel
目前我们讲的Redis还只是主从⽅案,最终⼀致性。读者们可思考
过,如果主节点凌晨3点宕机?就坐等运维从爬起
来,然后⼿⼯进⾏从主切换,再所有的程序把地址统统改⼀遍重
新上线么?,这样的人⼯运维效率太低,事故发生时估计得
至少1个⼩时才能缓过来。如果是⼀个⼤型公司,这样的事故⾜以
上了。
所以须有⼀个⾼可⽤⽅案来抵抗节点故障,当故障发生时可以
自动进⾏从主切换,程序可以不⽤重启,运维可以继续睡⼤觉,仿佛
什么事也没发生⼀样。Redis官⽅了这样⼀种⽅案——Redis
Sentinel(哨兵)。
Cluster1:Sentinel
Atpresent,theRediswearetalkingaboutisonlyamaster-slavesolutionwith
eventualconsistency.Readersmayhavethoughtaboutwhattodoifthemaster
nodesuddenlygoesdownat3oclockinthemorning?Justwaitfortheoperation
andmaintenancetogetoutofbed,thenmanuallyswitchfromthemaster,andt
hennotifyallprogramstochangealltheaddressesandcomeonlineagain?Thereis
nodoubtthatsuchmanualoperationandmaintenanceistooinefficient.Whenan
accidentoccurs,itisestimatedthatitwilltakeatleastanhourtorecover.Ifyou
werealargecompany,anaccidentlikethiswouldbeenoughtomakethenews.
Therefore,wemusthaveahigh-availabilitysolutiontoresistnodefailure.Whena
failureoccurs,itcanautomaticallyswitchfromthemaster,theprogramdoesnot
needtoberestarted,andtheoperationandmaintenancecancontinuetosleepasif
nothinghappened.Redislyprovidessuchasolution-RedisSentinel.
我们可以将RedisSentinel集群看成是⼀个ZooKeeper集群,它
是集群⾼可⽤的⼼脏,它⼀般是由3~5个节点组成,这样挂了个别
节点集群还可以正常运转。
它负责持续主从节点的健康,当主节点挂掉时,自动选择⼀个最
优的从节点切换为主节点。客户端来连接集群时,会首先连接
sentinel,通过sentinel来查询主节点的地址,然后再去连接主节
点进⾏数据交互。当主节点发生故障时,客户端会重新向sentinel
要地
您可能关注的文档
最近下载
- 【考研数学】2024 武忠祥 严选题做题本 数学二 (竖版A4).doc VIP
- (LR3.5)地测空间管理信息系统使用手册(1).pdf VIP
- 【做题本】平板版25考研数学周洋鑫考点全刷基础篇·线代.doc VIP
- 考研数学2025年线代基础测试.docx VIP
- 2025年考研数学《线性代数》专项训练试卷.docx VIP
- 2025年考研数学线代真题模拟冲刺试卷(含答案).docx VIP
- 【做题本】A4版25考研数学周考点全刷.doc VIP
- 青海民间小调.pdf
- 成人2型糖尿病口服降糖药联合治疗专家共识(2025版)解读PPT课件.pptx VIP
- 2026马年春节小学生主题班会课件(共21张PPT).pptx VIP
原创力文档

文档评论(0)