查看集群分配
curl http://localhost:9200/_cluster/allocation/explain
查看各个分片状态
curl -X GET -s xx.xx.xx.xx:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason
Elasticsearch 节点磁盘使用率过高,导致ES集群索引无副本
cluster.routing.allocation.disk.watermark.low
Controls 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.high
Controls 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_stage
Controls 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% 的时候,当前节点的所有索引将被设置为只读索引。
参考
ES 分片失败:UNASSIGNED reason为node_left 的 解决方案
https://www.cnblogs.com/whl-jx911/p/14482749.html
ES集群存储扩容及在线调整配置
https://www.jianshu.com/p/3d9caa788e66
Elasticsearch 节点磁盘使用率过高,导致ES集群索引无副本
https://www.shuzhiduo.com/A/Ae5RPjl3zQ/