@@ -82,27 +82,32 @@ enable forced awareness.
82
82
[[forced-awareness]]
83
83
===== Forced awareness
84
84
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.
89
88
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.
93
95
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:
97
99
98
100
[source,yaml]
99
101
-------------------------------------------------------------------
100
102
cluster.routing.allocation.awareness.attributes: zone
101
103
cluster.routing.allocation.awareness.force.zone.values: zone1,zone2 <1>
102
104
-------------------------------------------------------------------
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