# Remove Node From Cluster?

**URL:** <https://discuss.elastic.co/t/remove-node-from-cluster/65257>\
**Category:** Elasticsearch\
**Created:** [November 7, 2016, 6:25pm UTC](https://discuss.elastic.co/t/remove-node-from-cluster/65257 "2016-11-07T18:25:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Thoma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_thoma/32/12827_2.png) [@Mike\_Thoma](https://discuss.elastic.co/u/Mike_Thoma)\
**Post date:** [November 7, 2016, 6:25pm UTC](https://discuss.elastic.co/t/remove-node-from-cluster/65257/1 "2016-11-07T18:25:23Z")

</div>

Good day,

While putting together a POC for a client, a team member accidentally terminated a node in AWS. My cluster health is "red".

I see how you can exclude a node by IP, but the IP address was lost.

What is the most graceful way of removing the node if all I know is the node name?

Thanks for your time.  
Mike

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [November 7, 2016, 6:52pm UTC](https://discuss.elastic.co/t/remove-node-from-cluster/65257/2 "2016-11-07T18:52:57Z")

</div>

Yes see Routing : [https://www.elastic.co/guide/en/elasticsearch/reference/5.0/allocation-filtering.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/allocation-filtering.html)

```
# Routing at Cluster level on attribute
curl -XPUT 'http://yourserver:9200/_cluster/settings?pretty' -d '
{
  "transient" : {
    "cluster.routing.allocation.exclude._name" : "node_name_to_exclude"
  }
}'
```

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [November 7, 2016, 6:56pm UTC](https://discuss.elastic.co/t/remove-node-from-cluster/65257/3 "2016-11-07T18:56:38Z")

</div>

Note that I recently have this problem: If you have mixed node versions and if shards have moved to a newer version, it cannot be re-moved to an older version node... (Mixing Version 2.2.0 and 2.4.1)

---

<div class="post-metadata">

**Author:** ![Mike\_Thoma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_thoma/32/12827_2.png) [@Mike\_Thoma](https://discuss.elastic.co/u/Mike_Thoma)\
**Post date:** [November 7, 2016, 7:48pm UTC](https://discuss.elastic.co/t/remove-node-from-cluster/65257/4 "2016-11-07T19:48:47Z")

</div>

Xavier you are the man!! Thank you! I will keep the version info in mind.

I deleted the node, added a new one, but the status is still red due to 3 unassigned shards. I have it set to no replicas, so not sure what's happening. Figured I'd check back for some help before I break things worse. I am still learning the basics if you couldn't tell.

> {  
> "cluster\_name" : "POC2",  
> "status" : "red",  
> "timed\_out" : false,  
> "number\_of\_nodes" : 2,  
> "number\_of\_data\_nodes" : 2,  
> "active\_primary\_shards" : 3,  
> "active\_shards" : 3,  
> "relocating\_shards" : 0,  
> "initializing\_shards" : 0,  
> "unassigned\_shards" : 3,  
> "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" : 50.0  
> }

---

<div class="post-metadata">

**Author:** ![Mike\_Thoma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_thoma/32/12827_2.png) [@Mike\_Thoma](https://discuss.elastic.co/u/Mike_Thoma)\
**Post date:** [November 7, 2016, 8:31pm UTC](https://discuss.elastic.co/t/remove-node-from-cluster/65257/5 "2016-11-07T20:31:37Z")

</div>

My issue with reassigning was due to not using the "allow\_primary" flag on the API. Fixed the unassigned using this:

> curl -XPOST "[http://localhost:9200/\_cluster/reroute](http://localhost:9200/_cluster/reroute)" -d'  
> {  
> "commands" : [ {  
> "allocate" : {  
> "index" : ".kibana", "shard" : 0, "node" : "node-1", "allow\_primary": "true"  
> }  
> }  
> ]  
> }'

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [November 7, 2016, 9:16pm UTC](https://discuss.elastic.co/t/remove-node-from-cluster/65257/6 "2016-11-07T21:16:33Z")

</div>

Good ! I hope everthing is Green now 😉

---

<div class="post-metadata">

**Author:** ![Mike\_Thoma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_thoma/32/12827_2.png) [@Mike\_Thoma](https://discuss.elastic.co/u/Mike_Thoma)\
**Post date:** [November 7, 2016, 9:29pm UTC](https://discuss.elastic.co/t/remove-node-from-cluster/65257/7 "2016-11-07T21:29:27Z")

</div>

![](https://us1.discourse-cdn.com/elastic/original/2X/1/15ca748c0de3aad70922b4c2052e0f35e27aaa12.jpg)

---

<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:** [December 5, 2016, 9:29pm UTC](https://discuss.elastic.co/t/remove-node-from-cluster/65257/8 "2016-12-05T21:29:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
