# Clustering ElasticSearch in "local" mode

**URL:** <https://discuss.elastic.co/t/clustering-elasticsearch-in-local-mode/9158>\
**Category:** Elasticsearch\
**Created:** [September 26, 2012, 1:14pm UTC](https://discuss.elastic.co/t/clustering-elasticsearch-in-local-mode/9158 "2012-09-26T13:14:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Smolyak](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@Michael\_Smolyak](https://discuss.elastic.co/u/Michael_Smolyak)\
**Post date:** [September 26, 2012, 1:14pm UTC](https://discuss.elastic.co/t/clustering-elasticsearch-in-local-mode/9158/1 "2012-09-26T13:14:00Z")

</div>

ElasticSearch Java API documentation describes the "local" mode  
of operation (  
[http://www.elasticsearch.org/guide/reference/java-api/client.html](http://www.elasticsearch.org/guide/reference/java-api/client.html)) where  
the ES server runs in the same JVM as the parent process. We are using this  
mode with our Grails application (through the ElasticSearch Grails Plugin).  
It works fine in case of a single Tomcat server running the Grails  
application. I am trying to cluster the Grails app by using a cluster of  
Tomcat servers. I wonder whether it is possible to cluster ElasticSearch  
servers running in the local mode (i.e., each runs in the same JVM as its  
parent Tomcat process). Is it possible to tell all the "local" ES servers  
to join the same cluster (and if so, how) or do I have to use the "node"  
mode by running ElasticSearch as a separate server process to achieve  
clustering?

Thank you,

Michael

--

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [September 26, 2012, 1:43pm UTC](https://discuss.elastic.co/t/clustering-elasticsearch-in-local-mode/9158/2 "2012-09-26T13:43:04Z")

</div>

Hi,  
If you are saying that each ES node runs in different JVM then I don't  
think it is possible.  
Lukas  
Dne 26.9.2012 15:14 "Michael Smolyak" [msmolyak.nextcentury@gmail.com](mailto:msmolyak.nextcentury@gmail.com)  
napsal(a):

> Elasticsearch Java API documentation describes the "local" mode  
> of operation (  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/client.html)) where  
> the ES server runs in the same JVM as the parent process. We are using this  
> mode with our Grails application (through the Elasticsearch Grails Plugin).  
> It works fine in case of a single Tomcat server running the Grails  
> application. I am trying to cluster the Grails app by using a cluster of  
> Tomcat servers. I wonder whether it is possible to cluster Elasticsearch  
> servers running in the local mode (i.e., each runs in the same JVM as its  
> parent Tomcat process). Is it possible to tell all the "local" ES servers  
> to join the same cluster (and if so, how) or do I have to use the "node"  
> mode by running Elasticsearch as a separate server process to achieve  
> clustering?
> 
> Thank you,
> 
> Michael
> 
> --

--

---

<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:** [September 26, 2012, 1:49pm UTC](https://discuss.elastic.co/t/clustering-elasticsearch-in-local-mode/9158/3 "2012-09-26T13:49:29Z")

</div>

If I understood your use case, I think that you could start a default node  
(without local(true)) and use then autodiscovery (by default) to build a cluster  
of ES nodes embedded in your tomcat webapp instances.

Why do you think you have to set your node as local?

David.

Le 26 septembre 2012 à 15:43, "Lukáš Vl?ek" [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) a écrit :

> Hi,  
> If you are saying that each ES node runs in different JVM then I don't think  
> it is possible.  
> Lukas
> 
> Dne 26.9.2012 15:14 "Michael Smolyak" \< [msmolyak.nextcentury@gmail.com](mailto:msmolyak.nextcentury@gmail.com)  
> [mailto:msmolyak.nextcentury@gmail.com](mailto:msmolyak.nextcentury@gmail.com) \> napsal(a):
> 
> > > Elasticsearch Java API documentation describes the "local" mode of  
> > > operation (  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/client.html)  
> > > [http://www.elasticsearch.org/guide/reference/java-api/client.html](http://www.elasticsearch.org/guide/reference/java-api/client.html) )  
> > > where the ES server runs in the same JVM as the parent process. We are  
> > > using this mode with our Grails application (through the Elasticsearch  
> > > Grails Plugin). It works fine in case of a single Tomcat server running  
> > > the Grails application. I am trying to cluster the Grails app by using  
> > > a cluster of Tomcat servers. I wonder whether it is possible to cluster  
> > > Elasticsearch servers running in the local mode (i.e., each runs in the  
> > > same JVM as its parent Tomcat process). Is it possible to tell all the  
> > > "local" ES servers to join the same cluster (and if so, how) or do I  
> > > have to use the "node" mode by running Elasticsearch as a separate  
> > > server process to achieve clustering?
> > 
> > Thank you,
> > 
> > Michael
> > 
> > --
> > 
> > >
> 
> --

--  
David Pilato  
[http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![Michael\_Smolyak](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@Michael\_Smolyak](https://discuss.elastic.co/u/Michael_Smolyak)\
**Post date:** [September 26, 2012, 2:16pm UTC](https://discuss.elastic.co/t/clustering-elasticsearch-in-local-mode/9158/4 "2012-09-26T14:16:20Z")

</div>

David,

Thank you for your response. What I have is a Grails application running in  
Tomcat. Grails Elasticsearch plugin supports three modes (based on ES Java  
API): local, node and transport. In local mode the ES server is started  
implicitly, while in node mode, (my understanding) I would have to start ES  
server as a separate process, which would complicate the overall setup.  
Thus I would like to run an embedded ES server, but be able to cluster them.

When you mention starting the default node, does it have to be started as a  
separate process? What do you mean by embedded then? How is embedded  
"local" different mean from embedded "node"?

Michael

On Wednesday, September 26, 2012 9:49:34 AM UTC-4, David Pilato wrote:

> If I understood your use case, I think that you could start a default  
> node (without local(true)) and use then autodiscovery (by default) to build  
> a cluster of ES nodes embedded in your tomcat webapp instances.
> 
> Why do you think you have to set your node as local?
> 
> David.
> 
> Le 26 septembre 2012 à 15:43, "Lukáš Vl?ek" \<[lukas...@gmail.com](mailto:lukas...@gmail.com)\<javascript:\>\>  
> a écrit :
> 
> Hi,  
> If you are saying that each ES node runs in different JVM then I don't  
> think it is possible.  
> Lukas  
> Dne 26.9.2012 15:14 "Michael Smolyak" \< [msmolyak.n...@gmail.com](mailto:msmolyak.n...@gmail.com)\<javascript:\>\>  
> napsal(a):
> 
> Elasticsearch Java API documentation describes the "local" mode  
> of operation (  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/client.html)) where  
> the ES server runs in the same JVM as the parent process. We are using this  
> mode with our Grails application (through the Elasticsearch Grails Plugin).  
> It works fine in case of a single Tomcat server running the Grails  
> application. I am trying to cluster the Grails app by using a cluster of  
> Tomcat servers. I wonder whether it is possible to cluster Elasticsearch  
> servers running in the local mode (i.e., each runs in the same JVM as its  
> parent Tomcat process). Is it possible to tell all the "local" ES servers  
> to join the same cluster (and if so, how) or do I have to use the "node"  
> mode by running Elasticsearch as a separate server process to achieve  
> clustering?
> 
> Thank you,
> 
> Michael
> 
> --
> 
> --
> 
> --  
> David Pilato  
> [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![Michael\_Smolyak](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@Michael\_Smolyak](https://discuss.elastic.co/u/Michael_Smolyak)\
**Post date:** [September 27, 2012, 9:19pm UTC](https://discuss.elastic.co/t/clustering-elasticsearch-in-local-mode/9158/5 "2012-09-27T21:19:22Z")

</div>

The solution was to use the "data node" by using (Java API)

nodeBuilder.client(false)  
nodeBuilder.data(true)

In that mode I do not need to run a separate server outside of the Web  
application and the two data nodes in Tomcat cluster can see each other.

On Wednesday, September 26, 2012 10:16:20 AM UTC-4, Michael Smolyak wrote:

> David,
> 
> Thank you for your response. What I have is a Grails application running  
> in Tomcat. Grails Elasticsearch plugin supports three modes (based on ES  
> Java API): local, node and transport. In local mode the ES server is  
> started implicitly, while in node mode, (my understanding) I would have to  
> start ES server as a separate process, which would complicate the overall  
> setup. Thus I would like to run an embedded ES server, but be able to  
> cluster them.
> 
> When you mention starting the default node, does it have to be started as  
> a separate process? What do you mean by embedded then? How is embedded  
> "local" different mean from embedded "node"?
> 
> Michael
> 
> On Wednesday, September 26, 2012 9:49:34 AM UTC-4, David Pilato wrote:
> 
> > If I understood your use case, I think that you could start a default  
> > node (without local(true)) and use then autodiscovery (by default) to build  
> > a cluster of ES nodes embedded in your tomcat webapp instances.
> > 
> > Why do you think you have to set your node as local?
> > 
> > David.
> > 
> > Le 26 septembre 2012 à 15:43, "Lukáš Vl?ek" [lukas...@gmail.com](mailto:lukas...@gmail.com) a  
> > écrit :
> > 
> > Hi,  
> > If you are saying that each ES node runs in different JVM then I don't  
> > think it is possible.  
> > Lukas  
> > Dne 26.9.2012 15:14 "Michael Smolyak" \< [msmolyak.n...@gmail.com](mailto:msmolyak.n...@gmail.com)\>  
> > napsal(a):
> > 
> > Elasticsearch Java API documentation describes the "local" mode  
> > of operation (  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/client.html)) where  
> > the ES server runs in the same JVM as the parent process. We are using this  
> > mode with our Grails application (through the Elasticsearch Grails Plugin).  
> > It works fine in case of a single Tomcat server running the Grails  
> > application. I am trying to cluster the Grails app by using a cluster of  
> > Tomcat servers. I wonder whether it is possible to cluster Elasticsearch  
> > servers running in the local mode (i.e., each runs in the same JVM as its  
> > parent Tomcat process). Is it possible to tell all the "local" ES servers  
> > to join the same cluster (and if so, how) or do I have to use the "node"  
> > mode by running Elasticsearch as a separate server process to achieve  
> > clustering?
> > 
> > Thank you,
> > 
> > Michael
> > 
> > --
> > 
> > --
> > 
> > --  
> > David Pilato  
> > [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> > [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<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:** [September 28, 2012, 12:28am UTC](https://discuss.elastic.co/t/clustering-elasticsearch-in-local-mode/9158/6 "2012-09-28T00:28:29Z")

</div>

IMHO, that's the default values when you create a node with the Java API.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 27 sept. 2012 à 23:19, Michael Smolyak [msmolyak.nextcentury@gmail.com](mailto:msmolyak.nextcentury@gmail.com) a écrit :

The solution was to use the "data node" by using (Java API)

```
			nodeBuilder.client(false)
			nodeBuilder.data(true)

```

In that mode I do not need to run a separate server outside of the Web application and the two data nodes in Tomcat cluster can see each other.

On Wednesday, September 26, 2012 10:16:20 AM UTC-4, Michael Smolyak wrote:

> David,
> 
> Thank you for your response. What I have is a Grails application running in Tomcat. Grails Elasticsearch plugin supports three modes (based on ES Java API): local, node and transport. In local mode the ES server is started implicitly, while in node mode, (my understanding) I would have to start ES server as a separate process, which would complicate the overall setup. Thus I would like to run an embedded ES server, but be able to cluster them.
> 
> When you mention starting the default node, does it have to be started as a separate process? What do you mean by embedded then? How is embedded "local" different mean from embedded "node"?
> 
> Michael
> 
> On Wednesday, September 26, 2012 9:49:34 AM UTC-4, David Pilato wrote:
> 
> > If I understood your use case, I think that you could start a default node (without local(true)) and use then autodiscovery (by default) to build a cluster of ES nodes embedded in your tomcat webapp instances.
> > 
> > Why do you think you have to set your node as local?
> > 
> > David.
> > 
> > Le 26 septembre 2012 à 15:43, "Lukáš Vl?ek" [lukas...@gmail.com](mailto:lukas...@gmail.com) a écrit :
> > 
> > > Hi,  
> > > If you are saying that each ES node runs in different JVM then I don't think it is possible.  
> > > Lukas
> > > 
> > > Dne 26.9.2012 15:14 "Michael Smolyak" \< [msmolyak.n...@gmail.com](mailto:msmolyak.n...@gmail.com)\> napsal(a):  
> > > Elasticsearch Java API documentation describes the "local" mode of operation ( [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/client.html)) where the ES server runs in the same JVM as the parent process. We are using this mode with our Grails application (through the Elasticsearch Grails Plugin). It works fine in case of a single Tomcat server running the Grails application. I am trying to cluster the Grails app by using a cluster of Tomcat servers. I wonder whether it is possible to cluster Elasticsearch servers running in the local mode (i.e., each runs in the same JVM as its parent Tomcat process). Is it possible to tell all the "local" ES servers to join the same cluster (and if so, how) or do I have to use the "node" mode by running Elasticsearch as a separate server process to achieve clustering?
> > > 
> > > Thank you,
> > > 
> > > Michael
> > > 
> > > --
> > > 
> > > --
> > 
> > --  
> > David Pilato  
> > [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> > [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

---

<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, 3:11am UTC](https://discuss.elastic.co/t/clustering-elasticsearch-in-local-mode/9158/7 "2017-07-06T03:11:02Z")

</div>


