# A graceful way to update/upgrade/restart

**URL:** <https://discuss.elastic.co/t/a-graceful-way-to-update-upgrade-restart/10971>\
**Category:** Elasticsearch\
**Created:** [March 1, 2013, 7:45pm UTC](https://discuss.elastic.co/t/a-graceful-way-to-update-upgrade-restart/10971 "2013-03-01T19:45:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sr\_ix](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sr_ix/32/2465_2.png) [@sr\_ix](https://discuss.elastic.co/u/sr_ix)\
**Post date:** [March 1, 2013, 7:45pm UTC](https://discuss.elastic.co/t/a-graceful-way-to-update-upgrade-restart/10971/1 "2013-03-01T19:45:28Z")

</div>

I wish to automate my (minor) upgrade/restart scripts for my ES cluster.  
I know that this is only applicable for upgrades like going from 0.20.4 to  
0.20.5 and I have read through DrTech's excellent post[http://elasticsearch-users.115913.n3.nabble.com/SImple-question-Is-elasticsearch-production-use-ready-td3430946.html#a3453676](http://elasticsearch-users.115913.n3.nabble.com/SImple-question-Is-elasticsearch-production-use-ready-td3430946.html#a3453676)on this exact topic.

I want to know more about the Shutdown API[http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown.html](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown.html),  
and have read through some other answers discussing its use.  
From what I understand, shards located on the deactivated node are  
reallocated to the remaining nodes in the cluster.

However, is this Shutdown API graceful? Does it just drop all connections  
to said node, or does it block future HTTP connections and drain the  
existing ones (like what one might expect from, say, CouchDB).  
Additionally, is there any way to restart from the Shutdown API, or would I  
be needing to ssh into said machine and re-run `service elasticsearch start` (from the servicewrapper plugin)

Thanks for your time,  
Steven

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Puneet](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@Puneet](https://discuss.elastic.co/u/Puneet)\
**Post date:** [May 17, 2013, 12:52pm UTC](https://discuss.elastic.co/t/a-graceful-way-to-update-upgrade-restart/10971/2 "2013-05-17T12:52:26Z")

</div>

I'm looking exactly for this. Any success with this yet?

On Saturday, March 2, 2013 1:15:28 AM UTC+5:30, sr-ix wrote:

> I wish to automate my (minor) upgrade/restart scripts for my ES cluster.  
> I know that this is only applicable for upgrades like going from 0.20.4 to  
> 0.20.5 and I have read through DrTech's excellent post[http://elasticsearch-users.115913.n3.nabble.com/SImple-question-Is-elasticsearch-production-use-ready-td3430946.html#a3453676](http://elasticsearch-users.115913.n3.nabble.com/SImple-question-Is-elasticsearch-production-use-ready-td3430946.html#a3453676)on this exact topic.
> 
> I want to know more about the Shutdown API[http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown.html](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown.html),  
> and have read through some other answers discussing its use.  
> From what I understand, shards located on the deactivated node are  
> reallocated to the remaining nodes in the cluster.
> 
> However, is this Shutdown API graceful? Does it just drop all connections  
> to said node, or does it block future HTTP connections and drain the  
> existing ones (like what one might expect from, say, CouchDB).  
> Additionally, is there any way to restart from the Shutdown API, or would  
> I be needing to ssh into said machine and re-run `service elasticsearch start` (from the servicewrapper plugin)
> 
> Thanks for your time,  
> Steven

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [May 17, 2013, 2:35pm UTC](https://discuss.elastic.co/t/a-graceful-way-to-update-upgrade-restart/10971/3 "2013-05-17T14:35:25Z")

</div>

As long as you have replicas, the node shutdown operation, when issued  
one by one and waiting for a green state, is graceful from the cluster's  
point of view. Note, it is not graceful for clients, they have to manage  
failover to another node for themselves. They will see connection  
failures if the node they talk to is being shut down.

There is a restart method in the Shutdown API (here, the REST version)

curl -XPOST /\_cluster/nodes/\_restart

curl -XPOST /\_cluster/nodes/{nodeId}/\_restart

which might be handy in a few cases, e.g. for reloading updated plugins  
without service interruption.

If you control ES from the service wrapper, you should stop/restart a  
node from there.

Jörg

Am 01.03.13 20:45, schrieb sr-ix:

> However, is this Shutdown API graceful? Does it just drop all  
> connections to said node, or does it block future HTTP connections and  
> drain the existing ones (like what one might expect from, say, CouchDB).  
> Additionally, is there any way to restart from the Shutdown API, or  
> would I be needing to ssh into said machine and re-run `service elasticsearch start` (from the servicewrapper plugin)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Pradeep\_Sanders](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pradeep_sanders/32/2326_2.png) [@Pradeep\_Sanders](https://discuss.elastic.co/u/Pradeep_Sanders)\
**Post date:** [May 18, 2013, 4:49am UTC](https://discuss.elastic.co/t/a-graceful-way-to-update-upgrade-restart/10971/4 "2013-05-18T04:49:31Z")

</div>

If you place Elasticsearch behind a load-balancer, the cluster maintenance  
can be made fully transparent to clients:

1. Add node IP to cluster exclude list
2. Configure load-balancer to drain the node, allowing existing connections  
to finish
3. When the load-balancer shows zero connections and the cluster has  
relocated all the shards on the node, shut it down
4. After starting the node back up and confirming that it is valid, remove  
the node IP from the cluster exclude list and enable it on the load-balancer

-Pradeep

On Friday, May 17, 2013 7:35:25 AM UTC-7, Jörg Prante wrote:

> As long as you have replicas, the node shutdown operation, when issued  
> one by one and waiting for a green state, is graceful from the cluster's  
> point of view. Note, it is not graceful for clients, they have to manage  
> failover to another node for themselves. They will see connection  
> failures if the node they talk to is being shut down.
> 
> There is a restart method in the Shutdown API (here, the REST version)
> 
> curl -XPOST /\_cluster/nodes/\_restart
> 
> curl -XPOST /\_cluster/nodes/{nodeId}/\_restart
> 
> which might be handy in a few cases, e.g. for reloading updated plugins  
> without service interruption.
> 
> If you control ES from the service wrapper, you should stop/restart a  
> node from there.
> 
> Jörg
> 
> Am 01.03.13 20:45, schrieb sr-ix:
> 
> > However, is this Shutdown API graceful? Does it just drop all  
> > connections to said node, or does it block future HTTP connections and  
> > drain the existing ones (like what one might expect from, say, CouchDB).  
> > Additionally, is there any way to restart from the Shutdown API, or  
> > would I be needing to ssh into said machine and re-run `service elasticsearch start` (from the servicewrapper plugin)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:35am UTC](https://discuss.elastic.co/t/a-graceful-way-to-update-upgrade-restart/10971/5 "2017-07-06T02:35:59Z")

</div>


