1、图解Elasticsearch容错机制:master选举,replica容错,数据恢复
(1)还是之前9个 shard,3个 node的例子
P0、P1、R22这三个shard丢失,master node 宕机的一瞬间,P0这个primary shard就没有了,并不是所有的primary shard处于active活跃状态,那么cluster status就变为red
容错第一步:master选举,自动选举其中一个node成为新的master,承担master的责任
(3)replica容错:新master将replica提升为primary shard,cluster status为yellow容错第二步:新master会将丢失的primary shard对应的某个replica shard提升为primary shard,此时cluster status变为了yellow,因为虽然primary shard全都变成active,但是R22这个replica shard还是非active的
(4)重启宕机node,master copy replica到该node,使用原有的shard并同步宕机后的修改,cluster status为green容错第三步:重启发生故障的node,新选举的master会将确实的副本都copy一份到重启的node上,而重启的node会使用之前已经存在的shard数据,只需要同步一下宕机之后修改的数据就可以了,此时cluster status为green