Skip to content

Commit 10ca010

Browse files
committed
Allocation awareness allocates some replicas (#104800)
The docs for forced awareness indicate that no replicas will be assigned until all zones are available, which is definitely undesirable and also not the actual behaviour. This commit fixes the wording to match what really happens. Closes #104777
1 parent 378c22a commit 10ca010

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

docs/reference/modules/cluster/allocation_awareness.asciidoc

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,27 +82,32 @@ enable forced awareness.
8282
[[forced-awareness]]
8383
===== Forced awareness
8484

85-
By default, if one location fails, Elasticsearch assigns all of the missing
86-
replica shards to the remaining locations. While you might have sufficient
87-
resources across all locations to host your primary and replica shards, a single
88-
location might be unable to host *ALL* of the shards.
85+
By default, if one location fails, {es} spreads its shards across the remaining
86+
locations. This might be undesirable if the cluster does not have sufficient
87+
resources to host all its shards when one location is missing.
8988

90-
To prevent a single location from being overloaded in the event of a failure,
91-
you can set `cluster.routing.allocation.awareness.force` so no replicas are
92-
allocated until nodes are available in another location.
89+
To prevent the remaining locations from being overloaded in the event of a
90+
whole-location failure, specify the attribute values that should exist with the
91+
`cluster.routing.allocation.awareness.force.*` settings. This will mean that
92+
{es} will prefer to leave some replicas unassigned in the event of a
93+
whole-location failure instead of overloading the nodes in the remaining
94+
locations.
9395

94-
For example, if you have an awareness attribute called `zone` and configure nodes
95-
in `zone1` and `zone2`, you can use forced awareness to prevent Elasticsearch
96-
from allocating replicas if only one zone is available:
96+
For example, if you have an awareness attribute called `zone` and configure
97+
nodes in `zone1` and `zone2`, you can use forced awareness to make {es} leave
98+
half of your shard copies unassigned if only one zone is available:
9799

98100
[source,yaml]
99101
-------------------------------------------------------------------
100102
cluster.routing.allocation.awareness.attributes: zone
101103
cluster.routing.allocation.awareness.force.zone.values: zone1,zone2 <1>
102104
-------------------------------------------------------------------
103-
<1> Specify all possible values for the awareness attribute.
104-
105-
With this example configuration, if you start two nodes with `node.attr.zone` set
106-
to `zone1` and create an index with 5 shards and 1 replica, Elasticsearch creates
107-
the index and allocates the 5 primary shards but no replicas. Replicas are
108-
only allocated once nodes with `node.attr.zone` set to `zone2` are available.
105+
<1> Specify all possible `zone` attribute values.
106+
107+
With this example configuration, if you have two nodes with `node.attr.zone`
108+
set to `zone1` and an index with `number_of_replicas` set to `1`, {es}
109+
allocates all the primary shards but none of the replicas. It will assign the
110+
replica shards once nodes with a different value for `node.attr.zone` join the
111+
cluster. In contrast, if you do not configure forced awareness, {es} will
112+
allocate all primaries and replicas to the two nodes even though they are in
113+
the same zone.

0 commit comments

Comments
 (0)