Elasticsearch集群 单个节点分片限制

   如果在 Elasticsearch 中单个节点上的分片数量超过了 cluster.max_shards_per_node 设置的限制(默认限制通常是1000分片),Elasticsearch 不会提供一个特定的状态码,而是会拒绝创建新的分片,并返回一个错误消息。这个错误消息通常会在创建索引或分片的 API 调用的 HTTP 响应体中体现,并伴随一个 HTTP 状态码。

在尝试创建超过限制的分片时,你可能会收到类似以下的错误消息:

{
  "error": {
    "root_cause": [
      {
        "type": "validation_exception",
        "reason": "Validation Failed: 1: this action would add [number] total shards, but this cluster currently has [number]/[limit] maximum shards open;"
      }
    ],
    "type": "validation_exception",
    "reason": "Validation Failed: 1: this action would add [number] total shards, but this cluster currently has [number]/[limit] maximum shards open;"
  },
  "status": 400
}

    在这种情况下,HTTP 状态码是 400,表示请求因为不满足验证条件而无法被执行。这个验证异常指出了创建操作将会导致的分片总数超过了集群配置的最大分片数。

   要解决这个问题,你可以选择重新设计索引策略,增加节点以分散分片,或者提高 cluster.max_shards_per_node 的配置值。不过,增加分片的上限需要谨慎考虑,因为这可能会导致性能问题或其他稳定性问题。

你可能感兴趣的:(elasticsearch,elasticsearch,大数据,搜索引擎)