# Migration data from a cluster to another cluster

**URL:** <https://discuss.elastic.co/t/migration-data-from-a-cluster-to-another-cluster/298915>\
**Category:** Elasticsearch\
**Created:** [March 6, 2022, 2:58pm UTC](https://discuss.elastic.co/t/migration-data-from-a-cluster-to-another-cluster/298915 "2022-03-06T14:58:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![alicango](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alicango/32/84498_2.png) [@alicango](https://discuss.elastic.co/u/alicango)\
**Post date:** [March 6, 2022, 2:58pm UTC](https://discuss.elastic.co/t/migration-data-from-a-cluster-to-another-cluster/298915/1 "2022-03-06T14:58:26Z")

</div>

Hello, dear community,

Assume that I have got 2 different clusters(Cluster-A and Cluster-B). Each cluster has 3 master nodes, 2 hot nodes, 2 warm nodes, and 2 cold nodes.  
My goal is to migrate all data from Cluster-A to Cluster-B. I know that everybody will suggest I take the last snapshot in Cluster-A and move it to the proper backup path in Cluster-B then restore backup on Cluster-B.

If I apply this way, could I move all data from Cluster-A to ClusterB?

**Step1;** Add all nodes(9 nodes) in ClusterB into Cluster-A. After being added all nodes, shard allocation will be starting from Cluster-A nodes to Cluster-B nodes.

**Step2;** Wait until complete the shard allocations. After completion of shard allocation, shutdown the Cluster-A

I am looking forward to your answer. thanks

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [March 6, 2022, 3:10pm UTC](https://discuss.elastic.co/t/migration-data-from-a-cluster-to-another-cluster/298915/2 "2022-03-06T15:10:57Z")

</div>

I don't think this will work, once a node has joined a cluster it won't join a different cluster.

So your data nodes that joined Cluster B won't be able to join Cluster A.

To migrate data between cluster you have a few options, you can use the Snapshot and Restore API, use the [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#reindex-from-remote) to reindex from remote, or use Logstash with the Elasticsearch input pointing from one cluster and the Elasticsearch output pointing to another one, which is kind similar as the reindex from remote.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 6, 2022, 10:21pm UTC](https://discuss.elastic.co/t/migration-data-from-a-cluster-to-another-cluster/298915/3 "2022-03-06T22:21:19Z")

</div>

If you want to add the new nodes to the existing cluster, setup allocation rules to move shards to them, then shutdown the old nodes, it'll work. You will still technically have the same cluster though, as you've essentially expanded the original cluster then shrunk it.

If that's what you are implying, and not literally starting a new cluster and adding it to the existing one, then go for it.

---

<div class="post-metadata">

**Author:** ![alicango](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alicango/32/84498_2.png) [@alicango](https://discuss.elastic.co/u/alicango)\
**Post date:** [March 6, 2022, 10:53pm UTC](https://discuss.elastic.co/t/migration-data-from-a-cluster-to-another-cluster/298915/4 "2022-03-06T22:53:09Z")

</div>

hi @warkolm,  
Actually, I mean the new cluster(Cluster-B). Not just data nodes will be added. I will also add the master nodes belonging the Cluster-B. Because Cluster-B also has 3 master nodes like an old cluster(Cluster-A). That is new cluster will have 6 master nodes, 4 hots, 4 warms, and 4 cold nodes. After completing the allocation, I will shut down Cluster-A. will it work?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 6, 2022, 10:58pm UTC](https://discuss.elastic.co/t/migration-data-from-a-cluster-to-another-cluster/298915/5 "2022-03-06T22:58:00Z")

</div>

You **cannot** join clusters. So if you are literally talking about taking these new nodes and creating a cluster called `cluster-b`, you cannot take those nodes and join them to `cluster-a`.

If you're referring to `cluster-b` as a concept that doesn't contain the original nodes, and you want the new nodes to be the only ones in the cluster, the that'll work. But it'll still technically be `cluster-a` from an Elasticsearch point.

Otherwise you need to be clear on your terminology here please.

---

<div class="post-metadata">

**Author:** ![alicango](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alicango/32/84498_2.png) [@alicango](https://discuss.elastic.co/u/alicango)\
**Post date:** [March 6, 2022, 11:36pm UTC](https://discuss.elastic.co/t/migration-data-from-a-cluster-to-another-cluster/298915/6 "2022-03-06T23:36:59Z")

</div>

@warkolm,  
Cluster-A has 9 nodes(3 masters, 2 hot, 2 warms, 2 colds). Cluster-B is the same as well... All data is stored in Cluster-A. I want to move these data to the Cluster-B via the allocation method.  
cluster name of Cluster-A is " **hello-Elasticsearch-A**"

- I will make the cluster name of Cluster-B to " **hello-Elasticsearch-A**" to be able to add to Cluster-A as a member by updating the Elasticsearch.yml file

- I will wait to complete the shard allocation from Cluster-A to Cluster-B(new member of Cluster-A)

- After completing the shard allocation, I will shut down the Cluster-A nodes(9 nodes) and Cluster-B will stay as a " **hello-Elasticsearch-A**"

is that clear?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 6, 2022, 11:41pm UTC](https://discuss.elastic.co/t/migration-data-from-a-cluster-to-another-cluster/298915/7 "2022-03-06T23:41:53Z")

</div>

> [@alicango](#):
>
> I will make the cluster name of Cluster-B to " **hello-Elasticsearch-A**" to be able to add to Cluster-A as a member by updating the Elasticsearch.yml file

Again, that won't work.

---

<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:** [April 3, 2022, 11:42pm UTC](https://discuss.elastic.co/t/migration-data-from-a-cluster-to-another-cluster/298915/8 "2022-04-03T23:42:35Z")

</div>

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