1.概述

转载:https://www.cnblogs.com/operationhome/p/12150530.html

2.问题

最近在查看线上的 es,发现最近2天的索引没有副本,集群的状态也是为 yellow 的。

3.问题的原因

es 所在的服务器磁盘是还有剩余空间的。只不过磁盘使用了大概 89%,按道理来说应该是会继续使用的,并创建索引的副本的,我们经过查阅官方文档。

cluster.routing.allocation.disk.watermark.lowControls the low watermark for disk usage. It defaults to 85%, meaning that Elasticsearch will not allocate shards to nodes that have more than 85% disk used. It can also be set to an absolute byte value (like 500mb) to prevent Elasticsearch from allocating shards if less than the specified amount of space is available. This setting has no effect on the primary shards of newly-created indices or, specifically, any shards that have never previously been allocated.cluster.routing.allocation.disk.watermark.highControls the high watermark. It defaults to 90%, meaning that Elasticsearch will attempt to relocate shards away from a node whose disk usage is above 90%. It can also be set to an absolute byte value (similarly to the low watermark) to relocate shards away from a node if it has less than the specified amount of free space. This setting affects the allocation of all shards, whether previously allocated or not.cluster.routing.allocation.disk.watermark.flood_stageControls the flood stage watermark. It defaults to 95%, meaning that Elasticsearch enforces a read-only index block (index.blocks.read_only_allow_delete) on every index that has one or more shards allocated on the node that has at least one disk exceeding the flood stage. This is a last resort to prevent nodes from running out of disk space. The index block must be released manually once there is enough disk space available to allow indexing operations to continue.

我们可以知道,es 集群的默认配置是当集群中的某个节点磁盘达到使用率为 85% 的时候,就不会在该节点进行创建副本,当磁盘使用率达到 90% 的时候,尝试将该节点的副本重分配到其他节点

当磁盘使用率达到95% 的时候,当前节点的所有索引将被设置为只读索引。

4.问题解决的办法

4.1 扩大磁盘

……

4.2 删除部分历史索引

可以看看 elasticsearch定时删除索引第二版

4.3 更改es设置

更改配置文件(需要重启es)
动态更改(api,无需重启)
es 的设置默认是 85% 和 90 %,我们更改为 90%和 95%。

4.3.1 更改配置文件(需要重启es)

在elasticsearch.yml 文件配置:

cluster.routing.allocation.disk.threshold_enabled: true
cluster.routing.allocation.disk.watermark.low: 90%
cluster.routing.allocation.disk.watermark.high: 95%
cluster.routing.allocation.disk.watermark.flood_stage: 98%

4.3.2、动态更改

所谓的动态更改就是通过 es 的 api 进行更改。transient 临时更改,persistent是永久更改。

api 接口 /_cluster/settings

注意 cluster.routing.allocation.disk.watermark.flood_stage 参数是 6.0 版本开始才有的,在5的版本是没有该配置的, 是不支持的,我在修改5.6 的版本的时候添加了该参数,是有错误返回的 “reason”:“persistent setting [cluster.routing.allocation.disk.watermark.flood_stage], not dynamically updateable”},“status”:4001. 5.6 版本官方文档链接:https://www.elastic.co/guide/en/elasticsearch/reference/5.6/disk-allocator.html

4.3.3 查看es 当前的配置

查看es 当前的配置 get 请求 /_cluster/settings。

curl 172.1.2.208:9200/_cluster/settings
{"persistent": {"xpack": {"monitoring": {"collection": {"enabled": "true"}}}},"transient": {"cluster": {"routing": {"allocation": {"disk": {"watermark": {"low": "90%","high": "95%"}}}},"info": {"update": {"interval": "1m"}}}}
}

4.3.4 永久更改 persistent

重启后不失效。

{"persistent": {  "cluster.routing.allocation.disk.watermark.low": "90%","cluster.routing.allocation.disk.watermark.high": "95%","cluster.info.update.interval": "1m"}
}

临时更改 transient

重启后配置失效。

{"transient": {  "cluster.routing.allocation.disk.watermark.low": "90%","cluster.routing.allocation.disk.watermark.high": "95%","cluster.info.update.interval": "1m"}
}

示例:

root@111:~# curl -H "Content-Type: application/json"  -XPUT  172.1.2.208:9200/_cluster/settings  -d '{"transient": {    "cluster.routing.allocation.disk.watermark.low": "90%", "cluster.routing.allocation.disk.watermark.high": "95%", "cluster.info.update.interval": "1m"}}'{"acknowledged":true,"persistent":{},"transient":{"cluster":{"routing":{"allocation":{"disk":{"watermark":{"low":"90%","high":"95%"}}}},"info":{"update":{"interval":"1m"}}}}}

四、扩展
其实我们在官方文档也就可以看到,就是我们不仅仅可以使用百分比来进行设置,我们也可以使用空间的大小来进行设置,类似500mb这样。

出处:https://www.cnblogs.com/operationhome/p/12150530.html

Elasticsearch 节点磁盘使用率过高,导致ES集群索引无副本相关推荐

  1. es集群节点加入失败join validation on cluster state with a different cluster uuid...than local cluster uuid..

    本来之前已经将es集群搭建完成了,但是不小心使用rm -rf /var/lib把文件删除了,我本来只想删除/var/lib下的一个文件夹的,结果删错了,整个集群没了,这,,,,还好集群上跑的都是一些测 ...

  2. 教你在Kubernetes中快速部署ES集群

    摘要:ES集群是进行大数据存储和分析,快速检索的利器,本文简述了ES的集群架构,并提供了在Kubernetes中快速部署ES集群的样例:对ES集群的监控运维工具进行了介绍,并提供了部分问题定位经验,最 ...

  3. ES集群(一)简介与集群搭建

    一.简介: 查看集群健康状况:URL+ /GET _cat/health,如http://xxx.xx.xxx.32:9200/_cluster/health?pretty=true 1.ES基本概念 ...

  4. 使用rke安装高可用k8s集群

    文章目录 使用rke安装高可用k8s集群 rke 增加和移除节点 彻底清理rke节点 使用rke安装高可用k8s集群 服务器rke集群节点角色规划 用户 主机名 内网IP SSH端口 系统 rke 角 ...

  5. Elasticsearch——Windows下ES集群部署 Linux下ES单节点、集群部署

    1.开篇 在之前的两篇文章中,说白了就是在windows下部署的ES单节点的环境. 这篇文章主要是说一下windows下部署ES集群.Linux下单节点部署. 单台 Elasticsearch 服务器 ...

  6. es集群搭建_滴滴Elasticsearch 集群跨版本升级与平台重构之路

    前不久,滴滴ES团队将维护的30多个ES集群,3500多个ES节点,8PB的数据,从2.3.3跨大版本无缝升级到6.6.1.在对用户查询写入基本零影响和改动的前提下,解决了ES跨大版本协议不兼容.文件 ...

  7. 【Elasticsearch】es 集群健康值 红色 red 分片 未分配

    1.概述 转载:https://zhuanlan.zhihu.com/p/101608973 转载这篇文章是因为根据我的文章 [Elasticsearch]elasticsearch 7.x 查看分片 ...

  8. 【ES实战】ES集群节点迁移与缩容补充说明

    [ES实战]ES集群节点迁移与缩容补充说明 [ES实战]ES集群节点迁移与缩容 文章目录 [ES实战]ES集群节点迁移与缩容补充说明 1.集群的现状分析和集群的规划 2.集群健康关注点,变化关注点 3 ...

  9. elasticsearch系列八:ES 集群管理(集群规划、集群搭建、集群管理)

    一.集群规划 搭建一个集群我们需要考虑如下几个问题: 1. 我们需要多大规模的集群? 2. 集群中的节点角色如何分配? 3. 如何避免脑裂问题? 4. 索引应该设置多少个分片? 5. 分片应该设置几个 ...

最新文章

  1. 诡异!MyBatis的Insert方法一直返回-2147482646?
  2. db2去除字段内容空格_Vue CLI3.x 配置指南生产环境去除console
  3. 黑马程序员_Java基础GUI
  4. Java 8和Java 14之间的新功能
  5. mysql主从报错_Mysql主从报错锦集
  6. 小艾k个人发卡网PHP源码
  7. 实战案例丨使用云连接CC和数据复制服务DRS实现跨区域RDS迁移和数据同步
  8. 下拉框value ,selectedIndex
  9. 20200702:最长公共子序列(leetcode1143)
  10. 荣耀Magic 2 3D感光版来了,和苹果Face ID系统有何不同?
  11. Attribute 和 Parameter 的区别
  12. 为什么总是封板又打开涨停_多次涨停多次被打开,涨停板打开然后封住反复
  13. Source Files 与 Resource Files 的区别
  14. CF1428F Fruit Sequences
  15. 苹果4s怎么越狱教程_苹果iOS 11.4-11.4.1越狱发布:附越狱教程
  16. 阿里云服务器的购买和部署
  17. springboot定期清理文件
  18. ALCOA+CCEA原则(数据完整性标准)
  19. 线程,进程,线程安全的理解
  20. 期权希腊字母更多的含义和解释

热门文章

  1. 华为旗下哈勃投资公司入股光刻机制造商科益虹源
  2. 王传福回应“芯片短缺”:比亚迪没有受到丝毫影响
  3. 马斯克公布柏林超级工厂航拍 白雪皑皑仍在施工
  4. “几乎看不见”的铰链!可折叠iPhone要来了?
  5. 三星Galaxy S21系列通过认证:终究还是要学苹果“保护环境”?
  6. 60秒语音有救了?曝微信测试语音进度条,内部人士一句话打回原形
  7. B 站 Up主自制秃头生成器,圆你一个秃头梦?
  8. 华为FreeBuds 3耳机更新推送:新增支持骨声纹识别特征
  9. A股春节后首个交易日 超3000股跌停
  10. 2G、3G即将退出群聊;全国携号转网就要实现了;5G商用列车已发车...