ElasticsearchIllegalArgumentException 错误

今天发现Elasticsearch集群,有好多索引的分片副本不能分配,然后就进行分片reroute操作,但是报错结果如下:[code]{"error":"ElasticsearchIllegalArgumentException[[allocate] allocation of [perfbase_201611][0] on node [EsDes14][NGrQorFlRASUo6khlbIQrg][EsDes14][inet[/10.0.0.17:9300]]{zone=zone2, master=false} is not allowed, reason: [YES(shard is not allocated to same node or host)][YES(node passes include/exclude/require filters)][YES(primary is already active)][YES(below shard recovery limit of [2])][YES(allocation disabling is ignored)][YES(allocation disabling is ignored)][YES(no allocation awareness enabled)][YES(total shard limit disabled: [-1] <= 0)][YES(target node version [1.7.3] is same or newer than source node version [1.7.5])][NO(more than allowed [85.0%] used disk on node, free: [9.81147727054615%])][YES(shard not primary or relocation disabled)]]","status":400}[/code]请问这是什么情况?怎么解决?
已邀请:

空心菜 - 心向阳光,茁壮成长

赞同来自: Rock

由你的错误:
[NO(more than allowed [85.0%] used disk on node, free: [9.81147727054615%])]
可知你迁移的节点上面,数据盘使用率已经达到了85%,为什么85%就不分配了呢?
 
因为默认ES启用了磁盘分配决策:
cluster.routing.allocation.disk.threshold_enabled 默认为True
那为什么是85%呢,这个跟你设置了cluster.routing.allocation.disk.watermark.high参数有关。
 
cluster.routing.allocation.disk.watermark.low:允许分配时的磁盘空间最小值,可以是比例或者绝对值,比如85%或者5G。当磁盘占用超过设定的值之后,系统将不会对此节点进行分配操作。
 
cluster.routing.allocation.disk.watermark.high:允许保存分片节点磁盘空间的最大值,当超过这个值后,系统会把分片迁移到别的节点。默认90%。也可以设置一个具体的大小值,当空间小于这个值的时候,系统会自动迁移到别的节点。

cluster.info.update.interval:检查集群中的每个节点的磁盘使用情况的时间间隔,默认30秒。

cluster.routing.allocation.disk.include_relocations:当计算节点的磁盘使用时需要考虑当前被分片的情况。
 
如果你想暂时解决这个问题,可以进行如下设置:
PUT /_cluster/settings{
"transient": {
"cluster.routing.allocation.disk.watermark.low": "95%",
"cluster.routing.allocation.disk.watermark.high": "20gb",
"cluster.info.update.interval": "1m"
}
}
 实例的含义是,每分钟检查一下磁盘空间,当磁盘空间小于95%的时候参与分片分配,当空间不足20G的时候,迁移节点的分片到别的节点。
 
如果想完全解决,你还是老老实实加数据节点吧,扩容集群。

要回复问题请先登录注册