Elasticsearch.yml - Weird clustering behavior

Hi all

I'm currently deploying two nodes of elasticsearch. The first node is the
standalone application, running on my local machine, using up port 9300 and
9200 for the WEB UI. As far as I know, it's using the configuration from
elasticsearch.yml in the config folder of the application.

The second instance is a version I've embedded in WildFly. I had been
using this logic to start up ES:

Settings settings = ImmutableSettings.settingsBuilder()
.put("data.path","/tmp/es")
.put("cluster.name","dev-es").build();
this.node = nodeBuilder().settings(settings).node();
this.client = node.client();

This is placed into an app scoped bean and freely available. I then said I
wanted to load my config from the default file, so reading around I came up
with this method that creates a StreamInput from the file sitting in the
config folder in JBoss (don't worry about configurationRetriever, it's
simply my wrapper for System.getProperty and other config we have):

private StreamInput readElasticSearchConfig() {
    String basePath = 

configurationRetriever.getConfigurationValue("jboss.server.config.dir");
String confFile =
configurationRetriever.getConfigurationValue("elasticsearch.conf.file","elasticsearch.yml");
try {
InputStream is = new FileInputStream(new File(basePath + "/" +
confFile));
StreamInput streamInput = new InputStreamStreamInput(is);
return streamInput;
} catch (FileNotFoundException e) {
throw new RuntimeException("Unable to locate config file
"+confFile+" in path "+basePath,e);
}
}

Then I changed my start up logic to:

StreamInput streamInput = readElasticSearchConfig();
Settings settings =
ImmutableSettings.readSettingsFromStream(streamInput);
this.node = nodeBuilder().settings(settings).node();
this.client = node.client();

I've confirmed things like my cluster name being correct, I think. They're
at least using the same file in both places. When the second node starts
up, it's not joining the cluster. The first configuration I posted does in
fact join the cluster. As I mentioned, both files are the OOTB yml files,
with the only change being storage location and cluster names.

Any idea why it might not be joining?

John

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e8c308f4-c58c-4153-8bb0-4072f10501b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.