curl -XGET “http://localhost:9200/_cat/shards?v”
curl -XGET localhost:9200/_cat/allocation?v
curl -XPUT ip:9200/_cluster/settings -d ‘{ “transient” : { “cluster.routing.allocation.disk.threshold_enabled” : false } }’
es可以根据磁盘使用情况来决定是否继续分配shard。默认设置是开启的,也可以通过api关闭:cluster.routing.allocation.disk.threshold_enabled: false
在开启的情况下,有两个重要的设置:
cluster.routing.allocation.disk.watermark.low:控制磁盘最小使用率。默认85%.说明es在磁盘使用率达到85%的时候将会停止分配新的shard。也可以设置为一个绝对数值,比如500M.
cluster.routing.allocation.disk.watermark.high:控制磁盘的最大使用率。默认90%.说明在磁盘使用率达到90%的时候es将会relocate shard去其他的节点。同样也可以设置为一个绝对值。
watermark setting可以通过update-api动态修改,默认es每隔30s会收集各个节点磁盘的使用情况,可以cluster.info.update.interval来设置时间间隔。