Elasticsearch.yml: dev/qa/production configuration?

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 pluginhttp://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

--

Can't you use maven profiles?

Lukas
Dne 3.10.2012 19:26 "Paul Sanwald" 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 pluginhttp://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

--

--

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 a écrit :

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
, 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://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--