、集群部署相关的知识点。今天我将详细的为大家介绍 ElasticSearch 集群规划与运维经验总结相关知识
上一节,我们介绍了 ElasticSearch 集群的部署、分片以及故障转移相关的知识点,并结合实例学入学习。在实际的企业环境,对于一个集群的规划也是相当重要的,接下来我们将与大家一起来探讨一下这个问题。
评估什么
根据什么评估
集群规模评估准则
评估什么
根据什么评估
索引配置评估准则
磁盘满了:
the node is above the high watermark cluster setting [cluster.routing.allocation.disk.watermark.high=95%], using more disk space than the maximum allowed [95.0%], actual free: [4.055101177689788%]
解决方法:扩容磁盘或者删除数据
分配文档数超过最大值限制:
failure IllegalArgumentException[number of documents in the index cannot exceed 2147483519
解决方法:向新索引中写入数据,并合理设置分片大小
主分片所在节点掉线
cannot allocate because a previous copy of the primary shard existed but can no longer be found on the nodes in the cluster
解决方法:找到节点掉线原因并重新启动节点加入集群,等待分片恢复。
索引属性与节点属性不匹配
node does not match index setting [index.routing.allocation.require] filters [temperature:“warm”,_id:“comdNq4ZSd2Y6ycB9Oubsg”]
解决方法:重新设置索引的属性,和节点保持一致,若要修改节点属性,则需要重启节点
节点长时间掉线后再次加入集群,导致引入脏数据
cannot allocate because all found copies of the shard are either stale or corrupt
解决方法:使用reroute API:
未分配的分片太多,导致达到了分片恢复的最大阈值,其他分片需要排队等待
reached the limit of incoming shard recoveries [2], cluster setting [cluster.routing.allocation.node_concurrent_incoming_recoveries=2] (can also be set via [cluster.routing.allocation.node_concurrent_recoveries])
解决方法:使用cluster/settings调大分片恢复的并发度和速度。
事情起因很简单,同事对于我写的一个索引报了如下问题。出于学习目的排查下。
常见的ES集群有三种状态,如下:
如下图所示分别为green和red的样子。
GET /_cluster/health
对于上述red的情况。需要重点关注unassigned_shards没有正常分配的分片。
方法一:查看所有索引状况,如下就是有问题的。右侧查找 red 关键词。
GET /_cat/indices
方法二:直接查看unassigned的shard。
查找 unassigned 关键词。
GET /_cat/shards
使用 Cluster Allocation Explain API ,返回集群为什么不分配分片的详细原因。
GET /_cluster/allocation/explain?pretty
curl -X GET "http://xxx.io:48888/_cluster/allocation/explain?pretty"
常见的 unassigned 原因,上一小节也具体描述过了。
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!