在 Mapping 里面,将 dynamic 参数设置成 strict 可以拒绝索引包含未知字段的文档。 此条 Tips 由 medcl 贡献。

es手动分片的时候报错,,es7.x

Elasticsearch | 作者 asd515407717 | 发布于2020年01月03日 | 阅读数:5532

执行语句:
POST /_cluster/reroute
{
"commands" : [
{
"move" : {
"index" : "elk_ordercompletion_2", "shard" : 1,
"from_node" : "es1", "to_node" : "es2"
}



}


]
}

报错:
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "[move_allocation] can't move 1, from {es1}{CefYJ1bbTFCzsBNbuQy8TA}{elk8gsgASdmdyto_arMdaw}{193.168.1.10}{193.168.1.10:9300}{ml.machine_memory=1910075392, xpack.installed=true, ml.max_open_jobs=20}, to {es2}{Z0fPS_4QT1e598eM6uVjKw}{s0ec23eyQpewAjdj7aQajg}{193.168.1.11}{193.168.1.11:9300}{ml.machine_memory=1910075392, ml.max_open_jobs=20, xpack.installed=true}, since its not allowed, reason: [YES(shard has no previous failures)][YES(shard is primary and can be allocated)][YES(explicitly ignoring any disabling of allocation due to manual allocation commands via the reroute API)][YES(can relocate primary shard from a node with version [7.1.1] to a node with equal-or-newer version [7.1.1])][YES(no snapshots are currently running)][YES(ignored as shard is not being recovered from a snapshot)][YES(node passes include/exclude/require filters)][NO(the shard cannot be allocated to the same node on which a copy of the shard already exists [[elk_ordercompletion_2][1], node[Z0fPS_4QT1e598eM6uVjKw], [R], s[STARTED], a[id=y0JHOZPORJOzDRN-IzpTlQ]])][YES(enough disk for shard on node, free: [12.7gb], shard size: [156.3kb], free after allocating shard: [12.7gb])][YES(below shard recovery limit of outgoing: [0 < 2] incoming: [0 < 2])][YES(the shard count [13] for this node is under the index limit [8] and cluster level node limit [-1])][YES(allocation awareness is not enabled, set cluster setting [cluster.routing.allocation.awareness.attributes] to enable it)]"
}
],
"type": "illegal_argument_exception",
"reason": "[move_allocation] can't move 1, from {es1}{CefYJ1bbTFCzsBNbuQy8TA}{elk8gsgASdmdyto_arMdaw}{193.168.1.10}{193.168.1.10:9300}{ml.machine_memory=1910075392, xpack.installed=true, ml.max_open_jobs=20}, to {es2}{Z0fPS_4QT1e598eM6uVjKw}{s0ec23eyQpewAjdj7aQajg}{193.168.1.11}{193.168.1.11:9300}{ml.machine_memory=1910075392, ml.max_open_jobs=20, xpack.installed=true}, since its not allowed, reason: [YES(shard has no previous failures)][YES(shard is primary and can be allocated)][YES(explicitly ignoring any disabling of allocation due to manual allocation commands via the reroute API)][YES(can relocate primary shard from a node with version [7.1.1] to a node with equal-or-newer version [7.1.1])][YES(no snapshots are currently running)][YES(ignored as shard is not being recovered from a snapshot)][YES(node passes include/exclude/require filters)][NO(the shard cannot be allocated to the same node on which a copy of the shard already exists [[elk_ordercompletion_2][1], node[Z0fPS_4QT1e598eM6uVjKw], [R], s[STARTED], a[id=y0JHOZPORJOzDRN-IzpTlQ]])][YES(enough disk for shard on node, free: [12.7gb], shard size: [156.3kb], free after allocating shard: [12.7gb])][YES(below shard recovery limit of outgoing: [0 < 2] incoming: [0 < 2])][YES(the shard count [13] for this node is under the index limit [8] and cluster level node limit [-1])][YES(allocation awareness is not enabled, set cluster setting [cluster.routing.allocation.awareness.attributes] to enable it)]"
},
"status": 400
}
已邀请:

Charele - Cisco4321

赞同来自: everything asd515407717 qiye eshty

看这个,
[NO(the shard cannot be allocated to the same node on which a copy of the shard already exists
 
这种操作要符合它的规则
(你可以更改这些规则,这是另外一个话题)
 
它的意思是说es2节点上面已经有了分片1,所以你不把把分片1移动到es2上面去。
 
另外,这个规则在SameShardAllocationDecider类里面,
能不能理解。看你愿不愿花时间去看。

要回复问题请先登录注册