ES集群分片无法迁移,手动move仍然报错怎么办?

2023-03-09 22:08:09 浏览数 (3)

一、先看两个报错

代码语言:txt复制
{
    "status":400,
    "body":{
        "error":{
            "root_cause":[
                {
                    "type":"illegal_argument_exception",
                    "reason":"[move_allocation] can't move 0, from {1667208150001223332}{jQ6N4UQGT1qh5W4Yb1HWRw}{F5DnVEDwSuO3e33wRS8Hgw}{192.168.1.1}{192.168.1.1:9300}{ilrstw}{ml.machine_memory=16512847872, rack=cvm_4_200005, xpack.installed=true, set=200005, transform.node=true, ip=172.16.0.1, ml.max_open_jobs=512, ml.max_jvm_size=8589934592, region=4}, to {1677232737001267632}{alswNrDsTtu4dUrcZVYzfQ}{UQfi6og7S7qHgui-cWuRjg}{192.168.1.2}{192.168.1.2:9300}{ilrstw}{ml.machine_memory=33398218752, rack=cvm_4_200005, xpack.installed=true, set=200005, transform.node=true, ip=172.16.0.3, ml.max_open_jobs=512, ml.max_jvm_size=17179869184, region=4}, 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.14.2] to a node with equal-or-newer version [7.14.2])][YES(no snapshots are currently running)][YES(ignored as shard is not being recovered from a snapshot)][YES(this node is not currently shutting down)][NO(node does not match index setting [index.routing.allocation.require] filters [_id:"jQ6N4UQGT1qh5W4Yb1HWRw"])][YES(this node does not hold a copy of this shard)][YES(enough disk for shard on node, free: [3.2tb], shard size: [889.9mb], free after allocating shard: [3.2tb])][YES(below shard recovery limit of outgoing: [0 < 10] incoming: [1 < 10])][YES(total shard limits are disabled: [index: -1, cluster: -1] <= 0)][YES(node meets all awareness attribute requirements)][YES(index has a preference for tiers [data_warm,data_hot] and node has tier [data_warm])][YES(shard is not a follower and is not under the purview of this decider)][YES(decider only applicable for indices backed by searchable snapshots)][YES(this decider only applies to indices backed by searchable snapshots)][YES(decider only applicable for indices backed by searchable snapshots)][YES(this node's data roles are not exactly [data_frozen] so it is not a dedicated frozen node)]"
                }
            ],
            "type":"illegal_argument_exception",
            "reason":"[move_allocation] can't move 0, from {1667208150001223332}{jQ6N4UQGT1qh5W4Yb1HWRw}{F5DnVEDwSuO3e33wRS8Hgw}{192.168.1.1}{192.168.1.1:9300}{ilrstw}{ml.machine_memory=16512847872, rack=cvm_4_200005, xpack.installed=true, set=200005, transform.node=true, ip=172.16.0.1, ml.max_open_jobs=512, ml.max_jvm_size=8589934592, region=4}, to {1677232737001267632}{alswNrDsTtu4dUrcZVYzfQ}{UQfi6og7S7qHgui-cWuRjg}{192.168.1.2}{192.168.1.2:9300}{ilrstw}{ml.machine_memory=33398218752, rack=cvm_4_200005, xpack.installed=true, set=200005, transform.node=true, ip=172.16.0.3, ml.max_open_jobs=512, ml.max_jvm_size=17179869184, region=4}, 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.14.2] to a node with equal-or-newer version [7.14.2])][YES(no snapshots are currently running)][YES(ignored as shard is not being recovered from a snapshot)][YES(this node is not currently shutting down)][NO(node does not match index setting [index.routing.allocation.require] filters [_id:"jQ6N4UQGT1qh5W4Yb1HWRw"])][YES(this node does not hold a copy of this shard)][YES(enough disk for shard on node, free: [3.2tb], shard size: [889.9mb], free after allocating shard: [3.2tb])][YES(below shard recovery limit of outgoing: [0 < 10] incoming: [1 < 10])][YES(total shard limits are disabled: [index: -1, cluster: -1] <= 0)][YES(node meets all awareness attribute requirements)][YES(index has a preference for tiers [data_warm,data_hot] and node has tier [data_warm])][YES(shard is not a follower and is not under the purview of this decider)][YES(decider only applicable for indices backed by searchable snapshots)][YES(this decider only applies to indices backed by searchable snapshots)][YES(decider only applicable for indices backed by searchable snapshots)][YES(this node's data roles are not exactly [data_frozen] so it is not a dedicated frozen node)]"
        },
        "status":400
    }
}

{
    "status":400,
    "body":{
        "error":{
            "root_cause":[
                {
                    "type":"illegal_argument_exception",
                    "reason":"[move_allocation] can't move 9, from {1661148951006256332}{4lgZrVBkRWuJmHjog49eLA}{g4Ia-QRxScSPQdSYM8Gksw}{192.168.2.2}{192.168.2.2:9300}{cdhilrstw}{ml.machine_memory=33388974080, rack=cvm_1_100004, xpack.installed=true, set=100004, transform.node=true, ip=172.16.0.2, temperature=warm, ml.max_open_jobs=20, region=1}, to {1661148951006256232}{9jw0c4NTTXaAaBMs0qfp0A}{ZDNzuYqbS-2Qx91bcRx5nw}{192.168.2.3}{192.168.2.3:9300}{cdhilrstw}{ml.machine_memory=33388974080, rack=cvm_1_100004, xpack.installed=true, set=100004, transform.node=true, ip=172.16.0.4, temperature=warm, ml.max_open_jobs=20, region=1}, 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.10.1] to a node with equal-or-newer version [7.10.1])][YES(no snapshots are currently running)][YES(ignored as shard is not being recovered from a snapshot)][NO(node does not match index setting [index.routing.allocation.require] filters [temperature:"warm",_id:"7RWrD5QdRxWB1wlCP3jr_Q"])][YES(this node does not hold a copy of this shard)][YES(enough disk for shard on node, free: [3.5tb], shard size: [16.5mb], free after allocating shard: [3.5tb])][YES(below shard recovery limit of outgoing: [0 < 10] incoming: [0 < 10])][YES(total shard limits are disabled: [index: -1, cluster: -1] <= 0)][YES(node meets all awareness attribute requirements)][YES(node passes include/exclude/require/prefer tier filters)][YES(shard is not a follower and is not under the purview of this decider)][YES(decider only applicable for indices backed by searchable snapshots)]"
                }
            ],
            "type":"illegal_argument_exception",
            "reason":"[move_allocation] can't move 9, from {1661148951006256332}{4lgZrVBkRWuJmHjog49eLA}{g4Ia-QRxScSPQdSYM8Gksw}{192.168.2.2}{192.168.2.2:9300}{cdhilrstw}{ml.machine_memory=33388974080, rack=cvm_1_100004, xpack.installed=true, set=100004, transform.node=true, ip=172.16.0.2, temperature=warm, ml.max_open_jobs=20, region=1}, to {1661148951006256232}{9jw0c4NTTXaAaBMs0qfp0A}{ZDNzuYqbS-2Qx91bcRx5nw}{192.168.2.3}{192.168.2.3:9300}{cdhilrstw}{ml.machine_memory=33388974080, rack=cvm_1_100004, xpack.installed=true, set=100004, transform.node=true, ip=172.16.0.4, temperature=warm, ml.max_open_jobs=20, region=1}, 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.10.1] to a node with equal-or-newer version [7.10.1])][YES(no snapshots are currently running)][YES(ignored as shard is not being recovered from a snapshot)][NO(node does not match index setting [index.routing.allocation.require] filters [temperature:"warm",_id:"7RWrD5QdRxWB1wlCP3jr_Q"])][YES(this node does not hold a copy of this shard)][YES(enough disk for shard on node, free: [3.5tb], shard size: [16.5mb], free after allocating shard: [3.5tb])][YES(below shard recovery limit of outgoing: [0 < 10] incoming: [0 < 10])][YES(total shard limits are disabled: [index: -1, cluster: -1] <= 0)][YES(node meets all awareness attribute requirements)][YES(node passes include/exclude/require/prefer tier filters)][YES(shard is not a follower and is not under the purview of this decider)][YES(decider only applicable for indices backed by searchable snapshots)]"
        },
        "status":400
    }
}

看到这种东西是不是很害怕,一下子就懵了,密密麻麻什么东西,到底哪一条是有效信息,其实从某种角度来讲哈,给的信息越多该问题就越简单(玩笑而已切勿当真)

二、废话不多说,上才艺
  • 将该返回信息格式化一下 json.cn 就会有意外收获
场景一场景一
场景二场景二
三、是不是很惊喜,这个NO很突出哦
  • 仔细一看,原来是该索引有个属性,将它分配给了某个节点,使其无法在节点之间移动
代码语言:txt复制
"index.routing.allocation.require._id": "jQ6N4UQGT1qh5W4Yb1HWRw"
  • 好吧,那就将这个属性置为null吧
代码语言:txt复制
PUT xxxxxx/_settings
{
    "index.routing.allocation.require._id": null
}

可举一反三,同样适用于index.routing.allocation.require.xxxxxx其他配置

四、文章标题提到的move是什么
  • move
代码语言:txt复制
POST /_cluster/reroute
{
  "commands": [
    {
      "move": {
        "index": "test", "shard": 0,
        "from_node": "node1", "to_node": "node2"
      }
    }
  ]
}
  • 友情赠送retry
代码语言:txt复制
GET _cluster/allocation/explain
POST _cluster/reroute?retry_failed=true

reroute API要会用哈

https://www.elastic.co/guide/en/elasticsearch/reference/7.17/cluster-reroute.html

1 人点赞