简体   繁体   English

前哨故障转移后复活时原始Redis主服务器的状态

[英]State of the original redis master upon resurrection after sentinel failover

Consider the following setup for a redis high-availability solution: 3 VMs each running an instance of redis server and an instance of sentinel to monitor the setup. 考虑以下用于Redis高可用性解决方案的设置:3个VM,每个VM运行一个Redis服务器实例和一个哨兵实例来监视设置。 R1 (redis on VM1 ) is configured as a master, R2 and R3 as slaveof R1 ; R1VM1 redis)配置为主机, R2R3配置为slaveof R1 S1 ... S3 (sentinels) all monitor R1 with quorum of 2. All of this is statically written into redis.conf and redis-sentinel.conf on the corresponding VMs. S1 ... S3 (前哨)以法定数2监视所有R1 。所有这些均静态写入相应VM上的redis.confredis-sentinel.conf

Now consider VM1 (carrying R1 and S1 ) goes down. 现在考虑VM1 (承载R1S1 )掉线了。 The sentinels elect eg R2 as a new master and the client code, jedis , automatically adapts itself to the new state. 哨兵选择R2作为新的主服务器,而客户端代码jedis自动使自己适应新的状态。 So far so good. 到现在为止还挺好。

What exactly happens when VM1 is brought back up and R1 and S1 become available? 恢复VM1并使R1S1可用时,会发生什么情况?

In particular: 尤其是:

  • Will R1 join the remaining R2 and R3 to form a 3-node setup again (eg because S2 and S3 keep monitoring it)? R1加入其余的R2R3以形成3节点设置(例如,因为S2S3继续对其进行监视)?
  • If yes, will R1 get elected back to master or will remain a slave? 如果是, R1会被选回为主节点还是保留为从属节点? Should I care at all? 我应该在乎吗?
  • Will S1 join S2 and S3 to form a 3-node setup again? S1将再次与S2S3以形成3节点设置?
  • Will jedis adapt automatically? jedis会自动适应吗?

Sentinel will convert the old master to a slave of the new master and nothing needs to change unless another failover happens in which case this is all repeated. Sentinel会将旧的主节点转换为新的主节点的从节点,并且无需进行任何更改,除非发生另一个故障转移,在这种情况下,所有这些都将重复进行。 The detail are at the sentinel docs which directly answer your question for sentinel. 详细信息在哨兵文档中 ,这些文档直接回答您对哨兵的问题。

Jedis won't need to care about the old master rejoining as a slave. 杰迪斯(Jedis)不必担心旧主人重新成为奴隶。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM