Skip to content

Commit aa4ab0b

Browse files
authored
Expand docs on disk-based shard allocation (#65668)
Today we document the settings used to control rebalancing and disk-based shard allocation but there isn't really any discussion around what these processes do so it's hard to know what, if any, adjustments to make. This commit adds some words to help folk understand this area better.
1 parent 67704b0 commit aa4ab0b

File tree

2 files changed

+75
-7
lines changed

2 files changed

+75
-7
lines changed

docs/reference/modules/cluster/disk_allocator.asciidoc

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,62 @@
22
==== Disk-based shard allocation settings
33
[[disk-based-shard-allocation-description]]
44
// tag::disk-based-shard-allocation-description-tag[]
5-
{es} considers the available disk space on a node before deciding
6-
whether to allocate new shards to that node or to actively relocate shards away
7-
from that node.
5+
6+
The disk-based shard allocator ensures that all nodes have enough disk space
7+
without performing more shard movements than necessary. It allocates shards
8+
based on a pair of thresholds known as the _low watermark_ and the _high
9+
watermark_. Its primary goal is to ensure that no node exceeds the high
10+
watermark, or at least that any such overage is only temporary. If a node
11+
exceeds the high watermark then {es} will solve this by moving some of its
12+
shards onto other nodes in the cluster.
13+
14+
NOTE: It is normal for nodes to temporarily exceed the high watermark from time
15+
to time.
16+
17+
The allocator also tries to keep nodes clear of the high watermark by
18+
forbidding the allocation of more shards to a node that exceeds the low
19+
watermark. Importantly, if all of your nodes have exceeded the low watermark
20+
then no new shards can be allocated and {es} will not be able to move any
21+
shards between nodes in order to keep the disk usage below the high watermark.
22+
You must ensure that your cluster has enough disk space in total and that there
23+
are always some nodes below the low watermark.
24+
25+
Shard movements triggered by the disk-based shard allocator must also satisfy
26+
all other shard allocation rules such as
27+
<<cluster-shard-allocation-filtering,allocation filtering>> and
28+
<<forced-awareness,forced awareness>>. If these rules are too strict then they
29+
can also prevent the shard movements needed to keep the nodes' disk usage under
30+
control. If you are using <<data-tiers,data tiers>> then {es} automatically
31+
configures allocation filtering rules to place shards within the appropriate
32+
tier, which means that the disk-based shard allocator works independently
33+
within each tier.
34+
35+
If a node is filling up its disk faster than {es} can move shards elsewhere
36+
then there is a risk that the disk will completely fill up. To prevent this, as
37+
a last resort, once the disk usage reaches the _flood-stage_ watermark {es}
38+
will block writes to indices with a shard on the affected node. It will also
39+
continue to move shards onto the other nodes in the cluster. When disk usage
40+
on the affected node drops below the high watermark, {es} automatically removes
41+
the write block.
42+
43+
[[disk-based-shard-allocation-does-not-balance]]
44+
[TIP]
45+
====
46+
It is normal for the nodes in your cluster to be using very different amounts
47+
of disk space. The <<shards-rebalancing-settings,balance>> of the cluster
48+
depends only on the number of shards on each node and the indices to which
49+
those shards belong. It considers neither the sizes of these shards nor the
50+
available disk space on each node, for the following reasons:
51+
52+
* Disk usage changes over time. Balancing the disk usage of individual nodes
53+
would require a lot more shard movements, perhaps even wastefully undoing
54+
earlier movements. Moving a shard consumes resources such as I/O and network
55+
bandwidth and may evict data from the filesystem cache. These resources are
56+
better spent handling your searches and indexing where possible.
57+
58+
* A cluster with equal disk usage on every node typically performs no better
59+
than one that has unequal disk usage, as long as no disk is too full.
60+
====
861

962
You can use the following settings to control disk-based allocation:
1063

docs/reference/modules/cluster/shards_allocation.asciidoc

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,21 @@ one of the active allocation ids in the cluster state.
5656
[[shards-rebalancing-settings]]
5757
==== Shard rebalancing settings
5858

59+
A cluster is _balanced_ when it has an equal number of shards on each node
60+
without having a concentration of shards from any index on any node. {es} runs
61+
an automatic process called _rebalancing_ which moves shards between the nodes
62+
in your cluster to improve its balance. Rebalancing obeys all other shard
63+
allocation rules such as <<cluster-shard-allocation-filtering,allocation
64+
filtering>> and <<forced-awareness,forced awareness>> which may prevent it from
65+
completely balancing the cluster. In that case, rebalancing strives to acheve
66+
the most balanced cluster possible within the rules you have configured. If you
67+
are using <<data-tiers,data tiers>> then {es} automatically applies allocation
68+
filtering rules to place each shard within the appropriate tier. These rules
69+
mean that the balancer works independently within each tier.
70+
5971
You can use the following settings to control the rebalancing of shards across
6072
the cluster:
6173

62-
6374
`cluster.routing.rebalance.enable`::
6475
+
6576
--
@@ -97,9 +108,13 @@ Specify when shard rebalancing is allowed:
97108
[[shards-rebalancing-heuristics]]
98109
==== Shard balancing heuristics settings
99110

100-
The following settings are used together to determine where to place each
101-
shard. The cluster is balanced when no allowed rebalancing operation can bring the weight
102-
of any node closer to the weight of any other node by more than the `balance.threshold`.
111+
Rebalancing works by computing a _weight_ for each node based on its allocation
112+
of shards, and then moving shards between nodes to reduce the weight of the
113+
heavier nodes and increase the weight of the lighter ones. The cluster is
114+
balanced when there is no possible shard movement that can bring the weight of
115+
any node closer to the weight of any other node by more than a configurable
116+
threshold. The following settings allow you to control the details of these
117+
calculations.
103118

104119
`cluster.routing.allocation.balance.shard`::
105120
(<<dynamic-cluster-setting,Dynamic>>)

0 commit comments

Comments
 (0)