美文网首页elasticsearch 5.5官方文档阅读
Shard Allocation Filtering(分片分配过

Shard Allocation Filtering(分片分配过

作者: 菜花_Q | 来源:发表于2018-03-28 14:10 被阅读11次

    官网地址:Shard Allocation Filtering | Elasticsearch Reference [5.5] | Elastic

    Shard Allocation Filtering(分片分配过滤)

    虽然Index Shard Allocation提供了每个索引设置来控制碎片分配到节点,但是集群级的碎片分配过滤允许您允许或不允许将碎片从任何索引分配到特定的节点。

    集群范围的碎片分配筛选的典型用例是,当您想要将一个节点下线时,您希望在关闭该节点之前将该节点的shards从该节点移动到其他节点。

    例如,我们可以使用它的IP地址来下线一个节点:

    PUT _cluster/settings

    {

      "transient" : {

        "cluster.routing.allocation.exclude._ip" : "10.0.0.1"

      }

    }

    注意(note):只有在不破坏另一个路由约束的情况下,才可以重新定位碎片,比如不要将一个主和复制碎片分配给同一个节点。

    集群范围的碎片分配过滤工作原理与索引级碎片分配过滤相同。(详见Index Shard Allocation)。

    可用的动态集群设置如下所示,其中{attribute}引用任意节点属性。

    cluster.routing.allocation.include.{attribute}

    将索引赋给其{属性}至少有一个逗号分隔值的节点。

    cluster.routing.allocation.require.{attribute}

    将索引赋给其{属性}具有所有逗号分隔值的节点。

    cluster.routing.allocation.exclude.{attribute}

    将索引赋给其{属性}没有逗号分隔值的节点。

    这些特殊属性也得到了支持:

    _name 通过节点名匹配节点。

    _ip 通过IP地址(与主机名关联的IP地址)匹配节点

    _host 匹配节点的主机名

    所有属性值都可以用通配符来指定,例如:

    PUT _cluster/settings

    {

      "transient": {

        "cluster.routing.allocation.exclude._ip": "192.168.2.*"

      }

    }

    相关文章

      网友评论

        本文标题:Shard Allocation Filtering(分片分配过

        本文链接:https://www.haomeiwen.com/subject/exiycftx.html