@@ -75,27 +75,32 @@ enable forced awareness.
75
75
[[forced-awareness]]
76
76
===== Forced awareness
77
77
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.
82
81
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.
86
88
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:
90
92
91
93
[source,yaml]
92
94
-------------------------------------------------------------------
93
95
cluster.routing.allocation.awareness.attributes: zone
94
96
cluster.routing.allocation.awareness.force.zone.values: zone1,zone2 <1>
95
97
-------------------------------------------------------------------
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