# Elasticsearch-Indexing data in two different DataCenters

**URL:** <https://discuss.elastic.co/t/elasticsearch-indexing-data-in-two-different-datacenters/18661>\
**Category:** Elasticsearch\
**Created:** [July 14, 2014, 9:33pm UTC](https://discuss.elastic.co/t/elasticsearch-indexing-data-in-two-different-datacenters/18661 "2014-07-14T21:33:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![srikanth\_ramineni](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@srikanth\_ramineni](https://discuss.elastic.co/u/srikanth_ramineni)\
**Post date:** [July 14, 2014, 9:33pm UTC](https://discuss.elastic.co/t/elasticsearch-indexing-data-in-two-different-datacenters/18661/1 "2014-07-14T21:33:01Z")

</div>

Hi ,

i want to index same data in two different servers. Can you please suggest  
bestways to index in both DCs at same time.

* * *

having two Data centers- means two different clusters, want to index data  
into two different data centers(two different clusters) with same index  
name.

Please provide me inputs on this.

Thanks in advance

Srikanth.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 14, 2014, 10:52pm UTC](https://discuss.elastic.co/t/elasticsearch-indexing-data-in-two-different-datacenters/18661/2 "2014-07-14T22:52:18Z")

</div>

How are you expecting to index the data to one cluster?

Regards,  
Mark Walkom

Infrastructure Engineer  
Campaign Monitor  
email: [markw@campaignmonitor.com](mailto:markw@campaignmonitor.com)  
web: [www.campaignmonitor.com](http://www.campaignmonitor.com)

On 15 July 2014 07:33, srikanth ramineni [ri.srikanth@gmail.com](mailto:ri.srikanth@gmail.com) wrote:

> Hi ,
> 
> i want to index same data in two different servers. Can you please suggest  
> bestways to index in both DCs at same time.
> 
> * * *
> 
> having two Data centers- means two different clusters, want to index data  
> into two different data centers(two different clusters) with same index  
> name.
> 
> Please provide me inputs on this.
> 
> Thanks in advance
> 
> Srikanth.
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAEM624ZxXXX0yU62vUZQpr3jY%3DY5ws21PvM2ph4HvhP%3DNDfhVA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAEM624ZxXXX0yU62vUZQpr3jY%3DY5ws21PvM2ph4HvhP%3DNDfhVA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![srikanth\_ramineni](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@srikanth\_ramineni](https://discuss.elastic.co/u/srikanth_ramineni)\
**Post date:** [July 14, 2014, 11:12pm UTC](https://discuss.elastic.co/t/elasticsearch-indexing-data-in-two-different-datacenters/18661/3 "2014-07-14T23:12:32Z")

</div>

Hi Mark,

Thanks for your response..

Now we are using bulk request to index the data  
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name",  
"DC1\_TS3\_ES\_CLUSTER").build();  
Client client = new TransportClient(settings).addTransportAddress(new  
InetSocketTransportAddress("one", 9300))  
.addTransportAddress(new InetSocketTransportAddress("two", 9300))  
.addTransportAddress(new InetSocketTransportAddress("three", 9300))  
.addTransportAddress(new InetSocketTransportAddress("four", 9300));  
BulkRequestBuilder bulkRequest = client.prepareBulk();  
bulkRequest.add(client.prepareIndex(childIndex,  
"tnccontracts",rs.getString("ID")).setSource(mapper.writeValueAsString(map))  
.setParent(contractNo));  
bulkParentRequest.execute().actionGet();

Similarly i have another cluster DC2, Do i need to create again prepare  
bulk request ,add records to it, execute or Is there any way to index data  
into DC2 without creating another bulk request.

Thanks,  
Srikanth.

Now we are indexing to cluster  
On Monday, 14 July 2014 15:52:51 UTC-7, Mark Walkom wrote:

> How are you expecting to index the data to one cluster?
> 
> Regards,  
> Mark Walkom
> 
> Infrastructure Engineer  
> Campaign Monitor  
> email: [ma...@campaignmonitor.com](mailto:ma...@campaignmonitor.com) \<javascript:\>  
> web: [www.campaignmonitor.com](http://www.campaignmonitor.com)
> 
> On 15 July 2014 07:33, srikanth ramineni \<[ri.sr...@gmail.com](mailto:ri.sr...@gmail.com) \<javascript:\>
> 
> > wrote:
> 
> > Hi ,
> > 
> > i want to index same data in two different servers. Can you please  
> > suggest bestways to index in both DCs at same time.
> > 
> > * * *
> > 
> > having two Data centers- means two different clusters, want to index  
> > data into two different data centers(two different clusters) with same  
> > index name.
> > 
> > Please provide me inputs on this.
> > 
> > Thanks in advance
> > 
> > Srikanth.
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ba237ead-a27a-4d19-8f02-5df226fe473c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ba237ead-a27a-4d19-8f02-5df226fe473c%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 14, 2014, 11:15pm UTC](https://discuss.elastic.co/t/elasticsearch-indexing-data-in-two-different-datacenters/18661/4 "2014-07-14T23:15:33Z")

</div>

You'll have to send another request, but someone might be able to give you  
some hints around optimising that in your code.

Regards,  
Mark Walkom

Infrastructure Engineer  
Campaign Monitor  
email: [markw@campaignmonitor.com](mailto:markw@campaignmonitor.com)  
web: [www.campaignmonitor.com](http://www.campaignmonitor.com)

On 15 July 2014 09:12, srikanth ramineni [ri.srikanth@gmail.com](mailto:ri.srikanth@gmail.com) wrote:

> Hi Mark,
> 
> Thanks for your response..
> 
> Now we are using bulk request to index the data  
> Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name",  
> "DC1\_TS3\_ES\_CLUSTER").build();  
> Client client = new TransportClient(settings).addTransportAddress(new  
> InetSocketTransportAddress("one", 9300))  
> .addTransportAddress(new InetSocketTransportAddress("two", 9300))  
> .addTransportAddress(new InetSocketTransportAddress("three", 9300))  
> .addTransportAddress(new InetSocketTransportAddress("four", 9300));  
> BulkRequestBuilder bulkRequest = client.prepareBulk();  
> bulkRequest.add(client.prepareIndex(childIndex,  
> "tnccontracts",rs.getString("ID")).setSource(mapper.writeValueAsString(map))  
> .setParent(contractNo));  
> bulkParentRequest.execute().actionGet();
> 
> Similarly i have another cluster DC2, Do i need to create again prepare  
> bulk request ,add records to it, execute or Is there any way to index data  
> into DC2 without creating another bulk request.
> 
> Thanks,  
> Srikanth.
> 
> Now we are indexing to cluster  
> On Monday, 14 July 2014 15:52:51 UTC-7, Mark Walkom wrote:
> 
> > How are you expecting to index the data to one cluster?
> > 
> > Regards,  
> > Mark Walkom
> > 
> > Infrastructure Engineer  
> > Campaign Monitor  
> > email: [ma...@campaignmonitor.com](mailto:ma...@campaignmonitor.com)  
> > web: [www.campaignmonitor.com](http://www.campaignmonitor.com)
> > 
> > On 15 July 2014 07:33, srikanth ramineni [ri.sr...@gmail.com](mailto:ri.sr...@gmail.com) wrote:
> > 
> > > Hi ,
> > > 
> > > i want to index same data in two different servers. Can you please  
> > > suggest bestways to index in both DCs at same time.
> > > 
> > > * * *
> > > 
> > > having two Data centers- means two different clusters, want to index  
> > > data into two different data centers(two different clusters) with same  
> > > index name.
> > > 
> > > Please provide me inputs on this.
> > > 
> > > Thanks in advance
> > > 
> > > Srikanth.
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%  
> > > [40googlegroups.com](http://40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d8ce1d01-9f08-43f2-9173-a2a42a88995d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 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).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/ba237ead-a27a-4d19-8f02-5df226fe473c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ba237ead-a27a-4d19-8f02-5df226fe473c%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/ba237ead-a27a-4d19-8f02-5df226fe473c%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ba237ead-a27a-4d19-8f02-5df226fe473c%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAEM624ZGbuAjae-4rGJTwLSrXjv0a4KS\_qOqBszq1UAfHTXp8g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAEM624ZGbuAjae-4rGJTwLSrXjv0a4KS_qOqBszq1UAfHTXp8g%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:15am UTC](https://discuss.elastic.co/t/elasticsearch-indexing-data-in-two-different-datacenters/18661/5 "2017-07-06T01:15:49Z")

</div>


