删除分片分配过滤器

CPA*_*CPA 1 elasticsearch

我已经设置了一个分片分配过滤器,例如:

    PUT _cluster/settings
{
  "transient" : {
    "cluster.routing.allocation.exclude._name" : "node-1"
  }
}
Run Code Online (Sandbox Code Playgroud)

如何删除或禁用这样的设置?我尝试了包含,但后来我同时设置了两个过滤器-包含和排除。我可以设置类似"cluster.routing.allocation.exclude._name" : ""

但是也可以设置类似以下内容的include all节点吗?

Pau*_*non 8

你有没有尝试过

PUT _cluster/settings
{
  "transient" : {
    "cluster.routing.allocation.exclude._name" : null
  }
}
Run Code Online (Sandbox Code Playgroud)

听起来很愚蠢,但我认为这就是你在 elasticsearch 中取消设置的方式......


小智 6

对于在Elasticsearch 5.x上运行的集群,您可以传递null值以重置设置。如本期所述,此文档记录了群集级别的设置,但没有记录索引级别的设置。

因此,您可以执行以下操作:

PUT _cluster/settings
{
   "transient" : {
       "cluster.routing.allocation.exclude._name" : null
   }
}
Run Code Online (Sandbox Code Playgroud)

并且:

PUT test-index/_settings
{
  "index": {
    "routing": {
      "allocation": {
        "include": {
          "box_type": null
        },
        "exclude": {
          "box_type": null
        },
        "require": {
          "box_type": null
        },
        "total_shards_per_node": "2"
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)