3

ES集群故障转移_清晨的技术博客_51CTO博客

 7 months ago
source link: https://blog.51cto.com/u_13236892/7872648
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

6 ES集群故障转移

6.1 什么是故障转移

所谓故障转移指的是,当集群中有节点发生故障时,这个集群是如何进行自动修复的。
ES集群目前是由3个节点组成,如下图所示,此时集群状态是 green
ES集群故障转移_Red
ES集群故障转移_Red_02

6.2 模拟节点故障

假设:node1 所在机器宕机导致服务终止,此时集群会如何处理;大体分为三个步骤:
1.重新选举
2.主分片调整
3.副本分片调整

6.2.1 重新选举

node2 和 node3 发现 node1 无法响应;一段时间后会发起 master 选举,比如这里选择 node2 为 master 节点;此时集群状态变为 Red 状态;
ES集群故障转移_Red_03

6.2.2 主分片调整

node2 发现主分片 P0 未分配,将 node3 上的 R0 提升为主分片;此时所有的主分片都正常分配,集群状态变为 Yellow状态;
ES集群故障转移_Red_04
ES集群故障转移_Red_05

6.2.3 副本分片调整

node2 将 P0 和 P1 主分片重新生成新的副本分片 R0、R1,此时集群状态变为 Green;
ES集群故障转移_Red_06
ES集群故障转移_Red_07

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK