Skip to content

Commit 2f74248

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 4aea5fc commit 2f74248

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
@@ -75,27 +75,32 @@ enable forced awareness.
7575
[[forced-awareness]]
7676
===== Forced awareness
7777

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

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

87-
For example, if you have an awareness attribute called `zone` and configure nodes
88-
in `zone1` and `zone2`, you can use forced awareness to prevent Elasticsearch
89-
from allocating replicas if only one zone is available:
89+
For example, if you have an awareness attribute called `zone` and configure
90+
nodes in `zone1` and `zone2`, you can use forced awareness to make {es} leave
91+
half of your shard copies unassigned if only one zone is available:
9092

9193
[source,yaml]
9294
-------------------------------------------------------------------
9395
cluster.routing.allocation.awareness.attributes: zone
9496
cluster.routing.allocation.awareness.force.zone.values: zone1,zone2 <1>
9597
-------------------------------------------------------------------
96-
<1> Specify all possible values for the awareness attribute.
97-
98-
With this example configuration, if you start two nodes with `node.attr.zone` set
99-
to `zone1` and create an index with 5 shards and 1 replica, Elasticsearch creates
100-
the index and allocates the 5 primary shards but no replicas. Replicas are
101-
only allocated once nodes with `node.attr.zone` set to `zone2` are available.
98+
<1> Specify all possible `zone` attribute values.
99+
100+
With this example configuration, if you have two nodes with `node.attr.zone`
101+
set to `zone1` and an index with `number_of_replicas` set to `1`, {es}
102+
allocates all the primary shards but none of the replicas. It will assign the
103+
replica shards once nodes with a different value for `node.attr.zone` join the
104+
cluster. In contrast, if you do not configure forced awareness, {es} will
105+
allocate all primaries and replicas to the two nodes even though they are in
106+
the same zone.

0 commit comments

Comments
 (0)