【问题标题】:How to prevent shard relocation from hot nodes to warm or cold nodes?如何防止分片从热节点迁移到热节点或冷节点?
【发布时间】:2023-04-07 23:48:01
【问题描述】:

我有什么

  • Elasticsearch (7.7.0) 集群(amazon/opendistro-for-elasticsearch:1.8.0 Docker 镜像)
    • 一个主节点
    • 一个协调节点
    • 两个数据节点node.attr.data=hot
    • 一个带有node.attr.data=warm的数据节点

我想要什么:防止分片分配和重定位从热数据节点到热数据节点(以及未来冷数据节点)。

我尝试了什么

我已经为所有索引模板添加了"index.routing.allocation.require.data": "hot",因此新创建的索引不会分配给除了热数据节点之外的任何节点。这很好用。

无论如何,我不能将分片从热节点重定位到热节点。目前我正在使用"cluster.routing.allocation.exclude._ip" : "warm data node ip" 来防止从热数据节点重新定位到热数据节点。但是我可以将ILM 与此过滤器一起使用吗?

我也试过

PUT _cluster/settings
{
  "transient": {
    "cluster.routing.allocation.awareness.attributes": ["data"]
  }
}

PUT _cluster/settings
{
  "transient": {
    "cluster.routing.allocation.awareness.force.data.values": ["hot"]
  }
}

然后删除"cluster.routing.allocation.exclude._ip" 过滤器。无论如何,分片都从热数据节点重新定位到热数据节点。我错过了什么?

【问题讨论】:

    标签: elasticsearch elasticsearch-7 elasticsearch-opendistro


    【解决方案1】:

    我认为您错过了 ILM 政策中的分配意识。 你的暖阶段定义应该有

    "allocate": {
       "require": {
            "data": "warm"
        }
    }
    

    从您的定义中删除它,它应该可以解决您的问题。

    对我来说完全理解 ILM 的最佳文章是 https://www.elastic.co/blog/implementing-hot-warm-cold-in-elasticsearch-with-index-lifecycle-management 您将在“针对热-温-冷优化 ILM 策略”中找到完整示例

    【讨论】:

    • 但是 ILM 策略不会影响分片重定位。我还没有 ILM,无论如何,碎片都会从热转移到热
    • 让我再解释一下。我有一个正在运行的集群。我想添加新节点 - 温暖和寒冷。我不想让集群将分片从热节点重新平衡到热节点和冷节点。只有我将来添加的 ILM 可能能够将索引、分片移动到暖节点和冷节点
    • 更清楚了。一切看起来都在我看来。它应该已经适用于 index.routing.allocation.require.data。或者用集群设置你执行elastic.co/guide/en/elasticsearch/reference/current/…验证你的配置没问题吗?
    • 是的,我检查了GET /_cat/nodeattrs 并且我的节点具有正确的data 属性
    • 我应该为我的旧索引分配"index.routing.allocation.require.data": "hot"吗?
    【解决方案2】:

    我不得不更新我以前的 incides 的设置:

    PUT my-index/_settings
    {
      "index.routing.allocation.require.data": "hot"
    }
    

    如果更新索引模板,则不会更新某些索引模板下的索引。

    【讨论】:

    • 我目前面临同样的问题。我添加了 8TB 的暖节点,但我无法将旧索引分配给这个暖节点。当我尝试运行命令将索引之一移动到 old 时,它给了我错误“resource_already_exists_exception”,curl -XPUT localhost:9200/index_name/_settings { "settings": { "index.routing.allocation.require.box_type": "warm" } }
    猜你喜欢
    • 1970-01-01
    • 2020-11-21
    • 1970-01-01
    • 2013-09-24
    • 2012-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多