98 lines
3.6 KiB
Plaintext
98 lines
3.6 KiB
Plaintext
[[prevalidate-node-removal-api]]
|
|
=== Prevalidate node removal API
|
|
++++
|
|
<titleabbrev>Prevalidate node removal</titleabbrev>
|
|
++++
|
|
|
|
NOTE: {cloud-only}
|
|
|
|
Prevalidate node removal.
|
|
|
|
[[prevalidate-node-removal-api-request]]
|
|
==== {api-request-title}
|
|
|
|
`POST /_internal/prevalidate_node_removal`
|
|
|
|
[[prevalidate-node-removal-api-prereqs]]
|
|
==== {api-prereq-title}
|
|
|
|
* If the {es} {security-features} are enabled, you must have the `monitor` or `manage` <<privileges-list-cluster,cluster privilege>> to use this API.
|
|
|
|
[[prevalidate-node-removal-api-desc]]
|
|
==== {api-description-title}
|
|
|
|
This API checks whether attempting to remove the specified node(s) from the cluster is likely to succeed or not. For a cluster with no unassigned shards, removal of any node is considered safe which means the removal of the nodes is likely to succeed. In case the cluster has a <<cluster-health,`red` cluster health status>>, it verifies that the removal of the node(s) would not risk removing the last remaining copy of an unassigned shard.
|
|
|
|
The response includes the overall safety of the removal of the specified nodes, and a detailed response for each node. The node-specific part of the response also includes more details on why removal of that node might not succeed.
|
|
|
|
Note that only one of the query parameters (`names`, `ids`, or `external_ids`) must be used to specify the set of nodes.
|
|
|
|
Note that if the prevalidation result for a set of nodes returns `true` (i.e. it is likely to succeed), this does not mean that all those nodes could be successfully removed at once, but rather removal of each individual node would potentially be successful. The actual node removal could be handled via the <<node-lifecycle-api,Node lifecycle API>>.
|
|
|
|
[[prevalidate-node-removal-api-query-params]]
|
|
==== {api-query-parms-title}
|
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
|
|
|
|
`names`::
|
|
(Optional, string) Comma-separated list of node names.
|
|
|
|
`ids`::
|
|
(Optional, string) Comma-separated list of node IDs.
|
|
|
|
`external_ids`::
|
|
(Optional, string) Comma-separated list of node external IDs.
|
|
|
|
[[prevalidate-node-removal-api-response-body]]
|
|
==== {api-response-body-title}
|
|
|
|
`is_safe`::
|
|
(boolean) Whether the removal of all the provided nodes is safe or not.
|
|
|
|
`message`::
|
|
(string) A message providing more detail on why the operation is considered safe or not.
|
|
|
|
`nodes`::
|
|
(object) Prevalidation result for the removal of each of the provided nodes.
|
|
|
|
[[prevalidate-node-removal-api-example]]
|
|
==== {api-examples-title}
|
|
|
|
This example validates whether it is safe to remove the nodes `node1` and `node2`. The response indicates that it is safe to remove `node1`, but it might not be safe to remove `node2`. Therefore, the overall prevalidation of the removal of the two nodes returns `false`.
|
|
|
|
[source,console]
|
|
--------------------------------------------------
|
|
POST /_internal/prevalidate_node_removal?names=node1,node2
|
|
--------------------------------------------------
|
|
// TEST[skip:doc tests run with only a single node]
|
|
|
|
The API returns the following response:
|
|
|
|
[source,console-result]
|
|
--------------------------------------------------
|
|
{
|
|
"is_safe": false,
|
|
"message": "cluster health is RED",
|
|
"nodes": [
|
|
{
|
|
"id": "node1-id",
|
|
"name" : "node1",
|
|
"external_id" : "node1-externalId",
|
|
"result" : {
|
|
"is_safe": true,
|
|
"message": ""
|
|
}
|
|
},
|
|
{
|
|
"id": "node2-id",
|
|
"name" : "node2",
|
|
"external_id" : "node2-externalId",
|
|
"result" : {
|
|
"is_safe": false,
|
|
"message": "node may contain a copy of a red index shard"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
--------------------------------------------------
|