7.9.1
介绍处理方法前介绍几个es的基础概念,方便理解解决方法。
(资料图片)
1.es集群有元数据(clusterstate)包含cluster、index、shard级别的元数据,持久化保存在master-eligible节点
2.es集群第一次启动时称为bootstrap,该过程将配置文件中的cluster.initial_master_node作为初始的投票节点(Voting configurations),投票节点具有选举master和commitcluster state的权利,超过半数以上同意即投票成功。
3.使用UUID作为节点和集群的唯一表示,每个节点都会持久化当前集群的UUID
4.投票节点(Voting configurations)会变化,保证集群容错能力最大并且不会脑裂。假如现在投票节点有3个,加入了两个master-eligible节点,那么投票节点就会有5个,如果掉线了一个投票节点还是3个,数量会保持为奇数
大于等于qorum数量节点掉线,但仍有master-eligible节点存活
由于集群中投票节点永远不可能达到qorum,所以集群无法选主,但所幸cluster state还有一份。
使用bin/elasticsearch-node unsafe-bootstrap命令让唯一主节点以不安全的方式改写投票节点,就像重新进行bootstrap一样,自己使用持久化的cluster state形成一个新集群其他数据节点无法加入新集群因为UUID不同,使用bin/elasticsearch-node detach-cluster命令让节点离开之前的集群启动数据节点和新的master-eligible节点,他会加入新集群中。所有master-eligible节点掉线
我们已经没有clsuter state了,唯一的希望是数据节点上的index数据
启动足够的master-eligible节点形成一个新集群使用gateway.auto_import_dangling_indices: true配置启动数据节点。或者,启动数据节点并使用Import dangling indexAPI将index数据import到cluster state中。官方推荐后者这些index可以正常查询了使用dangling只能恢复index和shard元数据,cluster setting和alias等数据无法恢复,如果集群有重名index也无法成功import,比如.security7是安全相关的内部索引,也无法恢复
https://www.elastic.co/guide/en/elasticsearch/reference/7.9/node-tool.html#node-tool-detach-cluster
https://www.elastic.co/guide/en/elasticsearch/reference/7.9/modules-discovery.html
下一篇:最后一页
X 关闭
X 关闭