# Merge 2 Clusters with same name

**URL:** <https://discuss.elastic.co/t/merge-2-clusters-with-same-name/328065>\
**Category:** Elasticsearch\
**Created:** [March 20, 2023, 11:07am UTC](https://discuss.elastic.co/t/merge-2-clusters-with-same-name/328065 "2023-03-20T11:07:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![devarajsit](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@devarajsit](https://discuss.elastic.co/u/devarajsit)\
**Post date:** [March 20, 2023, 11:07am UTC](https://discuss.elastic.co/t/merge-2-clusters-with-same-name/328065/1 "2023-03-20T11:07:07Z")

</div>

Hi Team,

Is there any way where we can merge 2 clusters with same name to 1.

Scenario is... will have an existing cluster with name xyz and have some data. Will create additional cluster in different nodes with same name xyz and wont have any data. Can we merge these 2 and have same data fetched from both?

I have tried utilizing the discovery options but its not merging the nodes of other cluster to existing.

Any help is greatly appreciated.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 20, 2023, 11:19am UTC](https://discuss.elastic.co/t/merge-2-clusters-with-same-name/328065/2 "2023-03-20T11:19:56Z")

</div>

Welcome!

You can use cross cluster search and keep both clusters as they are now.

If you really need to merge the clusters, I'd suggest to do a backup of one of the cluster and restore in the other one. Or do a reindex from remote to reindex existing data from the old to the new one.

Then you can delete the old cluster.

---

<div class="post-metadata">

**Author:** ![devarajsit](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@devarajsit](https://discuss.elastic.co/u/devarajsit)\
**Post date:** [March 20, 2023, 11:50am UTC](https://discuss.elastic.co/t/merge-2-clusters-with-same-name/328065/3 "2023-03-20T11:50:26Z")

</div>

Hi @dadoonet ,

Thanks much for the response . Could you please provide some more details on cross cluster search? Any specific commands ? I know about cross cluster replication but not about cross cluster search.

Post that i can go for remote reindex.

Also once we do cross cluster search .. can we run both the cluster at the same time performing CRUD operations on data?

---

<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:** [March 20, 2023, 12:09pm UTC](https://discuss.elastic.co/t/merge-2-clusters-with-same-name/328065/5 "2023-03-20T12:09:35Z")

</div>

You can not merge two existing clusters even if they have the same ID. You could however wipe the nodes in the new cluster and set them up to join the other cluster. If there is no data that should be fine.

If you keep these clusters separate you can use cross-cluster search to search across both of them, although they would contain completely separate data sets. An update or insert into one cluster would not propagate to the other but you could serach for the data via cross-cluster search.

Why are you looking to merge clusters? Are the two clusters located far apart?

---

<div class="post-metadata">

**Author:** ![devarajsit](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@devarajsit](https://discuss.elastic.co/u/devarajsit)\
**Post date:** [March 20, 2023, 12:13pm UTC](https://discuss.elastic.co/t/merge-2-clusters-with-same-name/328065/6 "2023-03-20T12:13:30Z")

</div>

Hi @Christian_Dahlqvist ,

Yes , we are trying to migrate from one cluster to another without any downtime.

In order to achieve that , we need to have both the clusters UP and running , before i shutdown the old cluster. As i mentioned earlier , i have used discovery options to find out a node which is running in another cluster to join the current cluster, it didnt help.

Logs --  
{"type": "server", "timestamp": "2023-03-20T10:40:57,270Z", "level": "WARN", "component": "o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-1", "message": "master not discovered or elected yet, an election requires at least 2 nodes with ids from [4R5ELk3GToGBUYXLsr3OCQ, c3YC-9mWRPuv6W-2LbZoCg, 98nCGN8pQDOMfd5tjvhxQA], have only discovered non-quorum [{elasticsearch-master-1}{c3YC-9mWRPuv6W-2LbZoCg}{d6f9peb1Rbe2HaZiAHV9-g}{10.232.68.21}{10.232.68.21:9300}{ilmr}]; discovery will continue using [x.y.z.1:31777, x.y.z.2:31778, x.y.z.3:31779] from hosts providers and [{elasticsearch-master-1}{c3YC-9mWRPuv6W-2LbZoCg}{d6f9peb1Rbe2HaZiAHV9-g}{10.232.68.21}{10.232.68.21:9300}{ilmr}] from last-known cluster state; node term 74, last-accepted version 542 in term 74" }

---

<div class="post-metadata">

**Author:** ![devarajsit](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@devarajsit](https://discuss.elastic.co/u/devarajsit)\
**Post date:** [March 21, 2023, 12:09pm UTC](https://discuss.elastic.co/t/merge-2-clusters-with-same-name/328065/7 "2023-03-21T12:09:20Z")

</div>

Any Reason why discovery attributes wont work when its multiple clusters?

---

<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 18, 2023, 12:09pm UTC](https://discuss.elastic.co/t/merge-2-clusters-with-same-name/328065/8 "2023-04-18T12:09:33Z")

</div>

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