# Stop elastic shard store on old elastic node

**URL:** <https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175>\
**Category:** Elasticsearch\
**Created:** [August 20, 2024, 6:45am UTC](https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175 "2024-08-20T06:45:00Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julian\_Fazri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julian_fazri/32/15921_2.png) [@Julian\_Fazri](https://discuss.elastic.co/u/Julian_Fazri)\
**Post date:** [August 20, 2024, 6:45am UTC](https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175/1 "2024-08-20T06:45:00Z")

</div>

Hi All,

I want to migrate existing elastic nodes to the new nodes using the join cluster method, So I don't have to backup-restore the data and kibana feature configuration. The details are below:

1. I have 3 existing elastic nodes, and it will become old nodes.
2. I also have 3 new elastic nodes.

I am joining all nodes, so there are 6 nodes in cluster with shards configuration 1 primary and 1 replica.

Is it possible to stop storing the data to 3 old elastic nodes, so next time forward the data only store in 3 new nodes, but the data on 3 old elastic nodes not removed or not migrated to the new nodes?

Thanks.

Best Regards,  
Julian Fazri

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [August 20, 2024, 8:33am UTC](https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175/2 "2024-08-20T08:33:56Z")

</div>

> [@Julian\_Fazri](#):
>
> Hi All,
> 
> I want to migrate existing elastic nodes to the new nodes using the join cluster method, So I don't have to backup-restore the data and kibana feature configuration. The details are below:
> 
> 1. I have 3 existing elastic nodes, and it will become old nodes.
> 2. I also have 3 new elastic nodes.
> 
> I am joining all nodes, so there are 6 nodes in cluster with shards configuration 1 primary and 1 replica.
> 
> Is it possible to stop storing the data to 3 old elastic nodes, so next time forward the data only store in 3 new nodes, but the data on 3 old elastic nodes not removed or not migrated to the new nodes?

Yes, it is possible to use IP addresses to exclude nodes instead of using node attributes. You can do this by using the Elasticsearch `_settings` API. Here is an example:

```auto
curl -X PUT "localhost:9200/_settings" -H 'Content-Type: application/json' -d'
{
  "index.routing.allocation.exclude._ip": "192.168.1.1,192.168.1.2,192.168.1.3"
}
'

```

> **[Cluster-level shard allocation and routing settings | Elasticsearch Guide...](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-cluster.html#cluster-shard-allocation-filtering)**

Regards

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 20, 2024, 8:39am UTC](https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175/3 "2024-08-20T08:39:46Z")

</div>

When you remove the 3 old nodes make sure you do not just drop all of them as 4 master eligible nodes are required to elect a master in a cluster with 6 master eligible nodes. Make sure to remove the nodes using the [voting config exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/current/voting-config-exclusions.html) before you remove them.

---

<div class="post-metadata">

**Author:** ![Julian\_Fazri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julian_fazri/32/15921_2.png) [@Julian\_Fazri](https://discuss.elastic.co/u/Julian_Fazri)\
**Post date:** [August 20, 2024, 8:59am UTC](https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175/4 "2024-08-20T08:59:58Z")

</div>

Hi @yago82,

I have tried this, what happen is the shards was moved from excluded IPs and there are no shards on excluded IPs.

Is that indicates the data was moved? We don't want that.

Thanks.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 20, 2024, 9:03am UTC](https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175/5 "2024-08-20T09:03:31Z")

</div>

I see I misunderstood. You intend to keep all nodes and not remove them. To control on which nodes specific indies are stored you can use [shard allocation filtering](https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-allocation-filtering.html). Label the old nodes one way and the new ones differently and then assign new indices to the new nodes through index template settings aligned with the shard allocation filtering.

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [August 20, 2024, 9:10am UTC](https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175/6 "2024-08-20T09:10:36Z")

</div>

Hi,

you can try this, at index level:

> **[Index-level shard allocation filtering | Elasticsearch Guide \[8.15\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-allocation-filtering.html#index-allocation-settings)**

Regards

---

<div class="post-metadata">

**Author:** ![Julian\_Fazri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julian_fazri/32/15921_2.png) [@Julian\_Fazri](https://discuss.elastic.co/u/Julian_Fazri)\
**Post date:** [August 20, 2024, 9:30am UTC](https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175/7 "2024-08-20T09:30:04Z")

</div>

Hi @Christian_Dahlqvist and @yago82 ,

If I use this, should I applied one by one to each index? Should I do this for system indices and data stream indices also?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 20, 2024, 9:45am UTC](https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175/8 "2024-08-20T09:45:59Z")

</div>

It has to be appliend to all indices that you wish to control the location of.

---

<div class="post-metadata">

**Author:** ![Julian\_Fazri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julian_fazri/32/15921_2.png) [@Julian\_Fazri](https://discuss.elastic.co/u/Julian_Fazri)\
**Post date:** [August 20, 2024, 9:52am UTC](https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175/9 "2024-08-20T09:52:25Z")

</div>

I have around 1000 indices, should I set it one by one? Or is there any ways like if the data after specific time, it will stored at new nodes?

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [August 20, 2024, 11:13am UTC](https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175/10 "2024-08-20T11:13:52Z")

</div>

You can automatically apply this to all new indices by index template for example

---

<div class="post-metadata">

**Author:** ![Julian\_Fazri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julian_fazri/32/15921_2.png) [@Julian\_Fazri](https://discuss.elastic.co/u/Julian_Fazri)\
**Post date:** [August 20, 2024, 4:43pm UTC](https://discuss.elastic.co/t/stop-elastic-shard-store-on-old-elastic-node/365175/11 "2024-08-20T16:43:06Z")

</div>

How about the old indices? I have try for index level shard allocation, the result is my shard on the old elastic nodes were moved. I am using the integration from elastic agent so index made by datastream.

Is it possible liks before today the data still stored one old nodes and not moved, but from today forward the data stored on new elastic nodes?
