# Elasticsearch.yml: dev/qa/production configuration?

**URL:** <https://discuss.elastic.co/t/elasticsearch-yml-dev-qa-production-configuration/9232>\
**Category:** Elasticsearch\
**Created:** [October 3, 2012, 5:26pm UTC](https://discuss.elastic.co/t/elasticsearch-yml-dev-qa-production-configuration/9232 "2012-10-03T17:26:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Sanwald](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_sanwald/32/2076_2.png) [@Paul\_Sanwald](https://discuss.elastic.co/u/Paul_Sanwald)\
**Post date:** [October 3, 2012, 5:26pm UTC](https://discuss.elastic.co/t/elasticsearch-yml-dev-qa-production-configuration/9232/1 "2012-10-03T17:26:37Z")

</div>

I'm wondering if anyone has a best practice for using a different  
elasticsearch.yml file for their development/qa/production environments?

my production cluster uses EC2/S3, and I don't want to use those services  
locally, so I'm looking for a (ideally maven friendly) way to switch  
between the two. The best thing I have found so far would involve using the  
ant plugin[http://maven.apache.org/guides/mini/guide-building-for-different-environments.html](http://maven.apache.org/guides/mini/guide-building-for-different-environments.html),  
which just feels dirty, but it will do in a pinch.

thanks in advance for your thoughts!

--paul

--

---

<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:** [October 4, 2012, 5:51am UTC](https://discuss.elastic.co/t/elasticsearch-yml-dev-qa-production-configuration/9232/2 "2012-10-04T05:51:28Z")

</div>

Can't you use maven profiles?

Lukas  
Dne 3.10.2012 19:26 "Paul Sanwald" [pcsanwald@gmail.com](mailto:pcsanwald@gmail.com) napsal(a):

> I'm wondering if anyone has a best practice for using a different  
> elasticsearch.yml file for their development/qa/production environments?
> 
> my production cluster uses EC2/S3, and I don't want to use those services  
> locally, so I'm looking for a (ideally maven friendly) way to switch  
> between the two. The best thing I have found so far would involve using  
> the ant plugin[http://maven.apache.org/guides/mini/guide-building-for-different-environments.html](http://maven.apache.org/guides/mini/guide-building-for-different-environments.html),  
> which just feels dirty, but it will do in a pinch.
> 
> thanks in advance for your thoughts!
> 
> --paul
> 
> --

--

---

<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:** [October 4, 2012, 7:16am UTC](https://discuss.elastic.co/t/elasticsearch-yml-dev-qa-production-configuration/9232/3 "2012-10-04T07:16:34Z")

</div>

IMHO, it's not a nice idea to embed config files in your artifact. That means  
that you have to create different artifact per platform (one for dev, one for  
qa, ...)  
I strongly think that it's best to have the same war/ear/whatever for all your  
platforms.

That said, what you want to do on the client side (I suppose) is to define the  
cluster name, the nodes to connect on, ... I don't think that there is much  
tuning to do on the client side.

What I have done on my project, is to use external property files (or JMX beans)  
to define settings for my ES Client (node or transport client).

I'm doing something like this:

@Autowired ConfigurationMBean configuration;

@Override  
protected Client buildClient() throws Exception {  
Settings settings = ImmutableSettings.settingsBuilder()  
.loadFromClasspath("mystandardclient-es.properties")  
.put("cluster.name", configuration.getEsClusterName())  
.build();

TransportClient client = new TransportClient(settings);

String jmxEsNodes = configuration.getEsNodes();  
String esNodes = jmxEsNodes.split(";");  
for (int i = 0; i \< esNodes.length; i++) {  
client.addTransportAddress(toAddress(esNodes[i]));  
}

return client;  
}

That's just an example. As you can see, I load from  
mystandardclient-es.properties which is common to all projects from  
src/main/resources dir and I define cluster.name after from my jmx settings.

My 2 cents  
HTH  
David.

Le 4 octobre 2012 à 07:51, "Lukáš Vl?ek" [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) a écrit :

> Can't you use maven profiles?
> 
> Lukas
> 
> Dne 3.10.2012 19:26 "Paul Sanwald" \< [pcsanwald@gmail.com](mailto:pcsanwald@gmail.com)  
> [mailto:pcsanwald@gmail.com](mailto:pcsanwald@gmail.com) \> napsal(a):
> 
> > > I'm wondering if anyone has a best practice for using a different  
> > > elasticsearch.yml file for their development/qa/production  
> > > environments?
> > 
> > my production cluster uses EC2/S3, and I don't want to use those services  
> > locally, so I'm looking for a (ideally maven friendly) way to switch between  
> > the two. The best thing I have found so far would involve using the ant  
> > plugin  
> > [http://maven.apache.org/guides/mini/guide-building-for-different-environments.html](http://maven.apache.org/guides/mini/guide-building-for-different-environments.html)  
> > , which just feels dirty, but it will do in a pinch.
> > 
> > thanks in advance for your thoughts!
> > 
> > --paul
> > 
> > --
> > 
> > >
> 
> --

--  
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:10am UTC](https://discuss.elastic.co/t/elasticsearch-yml-dev-qa-production-configuration/9232/4 "2017-07-06T03:10:13Z")

</div>


