shard allocation 是将分片分配到node上的过程。

这会发生在如下场景:initial recovery , replica allocation , rebalancing , add/remove nodes 。


控制shard allocation过程的设置参数有如下几种,所有的这些设置都是动态的

  • cluster-level shard allocation settings


    启用或禁用特定类型的shards allocation

    all(默认),允许所有类型的shard allocation

    primaries,只允许primary shard的allocation

    new_primaries,只允许primary shards for new indices的allocation

    none,不允许任何shard allocation

    这些设置不会影响重启一个节点时,local primary shards的recovery。
    cluster.routing.allocation.node_concurrent_incoming_recoveries在一个node上,最大允许的并发incoming shard recoveries。默认是2Incoming recoveries are the recoveries where the target shard (most likely the replica unless a shard is relocating) is allocated on the node. 
    cluster.routing.allocation.node_concurrent_outgoing_recoveries在一个node上,最大允许的并发outgoing shard recoveries。默认是2Outgoing recoveries are the recoveries where the source shard (most likely the primary unless a shard is relocating) is allocated on the node
    While the recovery of replicas happens over the network, the recovery of an unassigned primary after node restart uses data from the local disk. These should be fast so more initial primary recoveries can happen in parallel on the same node. Defaults to 4.
    Allows to perform a check to prevent allocation of multiple instances of the same shard on a single host, based on host name and host address. Defaults to false, meaning that no check is performed by default. This setting only applies if multiple nodes are started on the same machine.
  • disk-based shard allocation settings
  • shard allocation awareness / forced awareness
  • cluster-level shard allocation filtering
  • miscellaneous cluster-level settings 
  • No labels