shard allocation 是将分片分配到node上的过程。
这会发生在如下场景:initial recovery , replica allocation , rebalancing , add/remove nodes 。
master的主要角色之一就是决定那个分片分配到哪个节点上,以及什么时候在节点间移动分片来进行rebalance集群。
控制shard allocation过程的设置参数有如下几种,所有的这些设置都是动态的
cluster-level shard allocation settings
设置 说明 备注 cluster.routing.allocation.enable
启用或禁用特定类型的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。默认是2 Incoming 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。默认是2 Outgoing recoveries are the recoveries where the source shard (most likely the primary unless a shard is relocating) is allocated on the node cluster.routing.allocation.node_concurrent_recoveries
以上两个设置快捷设置。 cluster.routing.allocation.node_initial_primaries_recoveries
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
.cluster.routing.allocation.same_shard.host
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