Adds cluster health by awareness attribute documentation (#2398)

* Adds cluster health by awareness attribute documentation

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Added new response and edited note for clarity

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Minor rewording

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Incorporated doc review comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Minor edits

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* More updates

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Minor rewording

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Rewording

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Minor rewording

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Update _api-reference/cluster-health.md

Co-authored-by: Nate Bower <nbower@amazon.com>

* Update _api-reference/cluster-health.md

Co-authored-by: Nate Bower <nbower@amazon.com>

* Removed experimental flag and reworked to add in main body

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* One more merge conflict resolved

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Co-authored-by: Nate Bower <nbower@amazon.com>
This commit is contained in:
kolchfa-aws 2023-01-18 15:51:05 -05:00 committed by GitHub
parent efa9f99e8d
commit 1ff9a59bf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 102 additions and 3 deletions

View File

@ -36,7 +36,8 @@ The following table lists the available query parameters. All query parameters a
Parameter | Type | Description Parameter | Type | Description
:--- | :--- | :--- :--- | :--- | :---
expand_wildcards | Enum | Expands wildcard expressions to concrete indexes. Combine multiple values with commas. Supported values are `all`, `open`, `closed`, `hidden`, and `none`. Default is `open`. expand_wildcards | Enum | Expands wildcard expressions to concrete indexes. Combine multiple values with commas. Supported values are `all`, `open`, `closed`, `hidden`, and `none`. Default is `open`.
level | Enum | The level of detail for returned health information. Supported values are `cluster`, `indices`, and `shards`. Default is `cluster`. level | Enum | The level of detail for returned health information. Supported values are `cluster`, `indices`, `shards`, and `awareness_attributes`. Default is `cluster`.
awareness_attribute | String | The name of the awareness attribute, for which to return cluster health (for example, `zone`). Applicable only if `level` is set to `awareness_attributes`.
local | Boolean | Whether to return information from the local node only instead of from the cluster manager node. Default is false. local | Boolean | Whether to return information from the local node only instead of from the cluster manager node. Default is false.
cluster_manager_timeout | Time | The amount of time to wait for a connection to the cluster manager node. Default is 30 seconds. cluster_manager_timeout | Time | The amount of time to wait for a connection to the cluster manager node. Default is 30 seconds.
timeout | Time | The amount of time to wait for a response. If the timeout expires, the request fails. Default is 30 seconds. timeout | Time | The amount of time to wait for a response. If the timeout expires, the request fails. Default is 30 seconds.
@ -101,8 +102,106 @@ The following table lists all response fields.
|number_of_in_flight_fetch | Integer | The number of unfinished fetches. | |number_of_in_flight_fetch | Integer | The number of unfinished fetches. |
|task_max_waiting_in_queue_millis | Integer | The maximum wait time for all tasks waiting to be performed, in milliseconds. | |task_max_waiting_in_queue_millis | Integer | The maximum wait time for all tasks waiting to be performed, in milliseconds. |
|active_shards_percent_as_number | Double | The percentage of active shards in the cluster. | |active_shards_percent_as_number | Double | The percentage of active shards in the cluster. |
|awareness_attributes | Object | Contains cluster health information for each awareness attribute. |
## Returning cluster health by awareness attribute
To check cluster health by awareness attribute (for example, zone or rack), specify `awareness_attributes` in the `level` query parameter:
```json
GET _cluster/health?level=awareness_attributes
```
The response contains cluster health metrics partitioned by awareness attribute:
```json
{
"cluster_name": "runTask",
"status": "green",
"timed_out": false,
"number_of_nodes": 3,
"number_of_data_nodes": 3,
"discovered_master": true,
"discovered_cluster_manager": true,
"active_primary_shards": 0,
"active_shards": 0,
"relocating_shards": 0,
"initializing_shards": 0,
"unassigned_shards": 0,
"delayed_unassigned_shards": 0,
"number_of_pending_tasks": 0,
"number_of_in_flight_fetch": 0,
"task_max_waiting_in_queue_millis": 0,
"active_shards_percent_as_number": 100,
"awareness_attributes": {
"zone": {
"zone-3": {
"active_shards": 0,
"initializing_shards": 0,
"relocating_shards": 0,
"unassigned_shards": 0,
"data_nodes": 1,
"weight": 1
},
"zone-1": {
"active_shards": 0,
"initializing_shards": 0,
"relocating_shards": 0,
"unassigned_shards": 0,
"data_nodes": 1,
"weight": 1
},
"zone-2": {
"active_shards": 0,
"initializing_shards": 0,
"relocating_shards": 0,
"unassigned_shards": 0,
"data_nodes": 1,
"weight": 1
}
},
"rack": {
"rack-3": {
"active_shards": 0,
"initializing_shards": 0,
"relocating_shards": 0,
"unassigned_shards": 0,
"data_nodes": 1,
"weight": 1
},
"rack-1": {
"active_shards": 0,
"initializing_shards": 0,
"relocating_shards": 0,
"unassigned_shards": 0,
"data_nodes": 1,
"weight": 1
},
"rack-2": {
"active_shards": 0,
"initializing_shards": 0,
"relocating_shards": 0,
"unassigned_shards": 0,
"data_nodes": 1,
"weight": 1
}
}
}
}
```
If you're interested in a particular awareness attribute, you can include the name of the awareness attribute as a query parameter:
```json
GET _cluster/health?level=awareness_attributes&awareness_attribute=zone
```
In response to the preceding request, OpenSearch returns cluster health information only for the `zone` awareness attribute.
The unassigned shard information will be accurate only if you [enable replica count enforcement]({{site.url}}{{site.baseurl}}/opensearch/cluster#forced-replica-count-enforcement) and [configure forced awareness]({{site.url}}{{site.baseurl}}/opensearch/cluster#forced-awareness) for the awareness attribute either before cluster start or after cluster start but before any indexing requests. If you enable replica enforcement after the cluster receives indexing requests, the unassigned shard information may be inaccurate. If you don't configure replica count enforcement and forced awareness, the `unassigned_shards` field will contain -1.
{: .warning}
## Required permissions ## Required permissions
If you use the security plugin, make sure you have the appropriate permissions: If you use the Security plugin, make sure you have the appropriate permissions:
`cluster:monitor/health`. `cluster:monitor/health`.