<commit_before>[[cluster-nodes-shutdown]]
== Nodes Shutdown

The nodes shutdown API allows to shutdown one or more (or all) nodes in
the cluster. Here is an example of shutting the `_local` node the
request is directed to:

[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown'
--------------------------------------------------

Specific node(s) can be shutdown as well using their respective node ids
(or other selective options as explained
<<cluster-nodes,here>> .):

[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/nodeId1,nodeId2/_shutdown'
--------------------------------------------------

The master (of the cluster) can also be shutdown using:

[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_master/_shutdown'
--------------------------------------------------

Finally, all nodes can be shutdown using one of the options below:

[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/_shutdown'

$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_shutdown'

$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_all/_shutdown'
--------------------------------------------------

[float]
[[delay]]
=== Delay

By default, the shutdown will be executed after a 1 second delay (`1s`).
The delay can be customized by setting the `delay` parameter in a time
value format. For example:

[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown?delay=10s'
--------------------------------------------------

[float]
=== Disable Shutdown

The shutdown API can be disabled by setting `action.disable_shutdown` in
the node configuration.

[float]
=== Rolling Restart of Nodes (Full Cluster Restart)

A rolling restart allows the ES cluster to be restarted one node at a time, 
with no observable downtime for end users.  To perform a rolling restart:

* Disable shard allocation (so that Elasticsearch will not attempt to reallocate shards 
and waste I/O when each node is stopped and started).

[source,js]
--------------------------------------------------
curl -XPUT localhost:9200/_cluster/settings -d '{
                "transient" : {
                    "cluster.routing.allocation.enable" : "none"
                }
        }'
--------------------------------------------------

* Shut down a single node within the cluster (if you have dedicated master nodes, start with these before the data nodes). 
* Start the node back up and confirm that it has rejoined the cluster (using Marvel, cat nodes api, etc..)
* Repeat the above 2 steps for the remaining nodes, i.e. stop and start each node and confirm that it can rejoin the cluster.
* When this is done on all nodes, enable shard allocation.

[source,js]
--------------------------------------------------
   curl -XPUT localhost:9200/_cluster/settings -d '{
                "transient" : {
                    "cluster.routing.allocation.enable" : "all"
                }
        }'
--------------------------------------------------

* Confirm that the shards are properly allocated on all nodes.<commit_msg>Docs: Added deprecation notice to the _shutdown API and removed incorrect rolling restart docs<commit_after>[[cluster-nodes-shutdown]]
== Nodes Shutdown

deprecated[1.6.0, The `_shutdown` API will be removed in v2.0.0]

The nodes shutdown API allows to shutdown one or more (or all) nodes in
the cluster. Here is an example of shutting the `_local` node the
request is directed to:

[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown'
--------------------------------------------------

Specific node(s) can be shutdown as well using their respective node ids
(or other selective options as explained
<<cluster-nodes,here>> .):

[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/nodeId1,nodeId2/_shutdown'
--------------------------------------------------

The master (of the cluster) can also be shutdown using:

[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_master/_shutdown'
--------------------------------------------------

Finally, all nodes can be shutdown using one of the options below:

[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/_shutdown'

$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_shutdown'

$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_all/_shutdown'
--------------------------------------------------

[float]
[[delay]]
=== Delay

By default, the shutdown will be executed after a 1 second delay (`1s`).
The delay can be customized by setting the `delay` parameter in a time
value format. For example:

[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown?delay=10s'
--------------------------------------------------

[float]
=== Disable Shutdown

The shutdown API can be disabled by setting `action.disable_shutdown` in
the node configuration.

{'fraction_non_alphanumeric': 0.3026956196181206, 'fraction_numerical': 0.015537251965555972, 'mean_word_length': 1.6152716593245227, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3824674', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1256, 'n_words': 475}