Trasport Client load settings

Hello,

I am trying to create transport client for our remote 2 node es cluster
(version 1.3) in java. When I use "hardcoded" cluster details all works
just fine as code follows:

Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name",
"elasticsearch").build();
final Client client = new TransportClient(settings)
.addTransportAddress(new
InetSocketTransportAddress("bd-es1", 9300))
.addTransportAddress(new
InetSocketTransportAddress("bd-es2", 9300));

But when I try to use setting file elasticsearch.yml located in resources
with content like following:

cluster.name : elasticsearch
es.nodes : bd-es1:9300
es.port : 9300
local: false
client.transport.sniff: true

I am getting

INFO: [Bandit] loaded [], sites []
Exception in thread "main"
org.elasticsearch.client.transport.NoNodeAvailableException: None of the
configured nodes are available: []
at
org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:278)
at
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:197)
at
org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106)
at
org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:193)
at
org.elasticsearch.client.transport.TransportClient.get(TransportClient.java:384)
at
org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:201)
at
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
at com.ncr.bigdata.es.HelloElasticSearch.main(HelloElasticSearch.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Code were changed:

    Settings settings = 

ImmutableSettings.settingsBuilder().loadFromClasspath("elasticsearch.yml").build();

    final Client client = new TransportClient(settings);

I verified that settings get loaded properly.
I tried even those settings mentioned on Stack Overflow
network.host:
network.transport.tcp.port

But so far with no luck. Any hint would be appreciated.
Thx

--
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/ea988868-5f3c-4832-b521-58e6bd38e2ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Settings beginning with "es.*" are new to me in config files. They are only
for command line.

So I think es.nodes and es.port are ignored.

Beside that, the settings for the TransportClient do not set the host(s) to
connect to, they set the node of the TransportClient itself (which is quite
menaningless with regard to the connection settings).

Jörg

On Fri, Nov 14, 2014 at 11:07 AM, Jakub Stransky stransky.ja@gmail.com
wrote:

Hello,

I am trying to create transport client for our remote 2 node es cluster
(version 1.3) in java. When I use "hardcoded" cluster details all works
just fine as code follows:

Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name",
"elasticsearch").build();
final Client client = new TransportClient(settings)
.addTransportAddress(new
InetSocketTransportAddress("bd-es1", 9300))
.addTransportAddress(new
InetSocketTransportAddress("bd-es2", 9300));

But when I try to use setting file elasticsearch.yml located in resources
with content like following:

cluster.name : elasticsearch
es.nodes : bd-es1:9300
es.port : 9300
local: false
client.transport.sniff: true

I am getting

INFO: [Bandit] loaded , sites
Exception in thread "main"
org.elasticsearch.client.transport.NoNodeAvailableException: None of the
configured nodes are available:
at
org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:278)
at
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:197)
at
org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106)
at
org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:193)
at
org.elasticsearch.client.transport.TransportClient.get(TransportClient.java:384)
at
org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:201)
at
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
at com.ncr.bigdata.es.HelloElasticSearch.main(HelloElasticSearch.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Code were changed:

    Settings settings =

ImmutableSettings.settingsBuilder().loadFromClasspath("elasticsearch.yml").build();

    final Client client = new TransportClient(settings);

I verified that settings get loaded properly.
I tried even those settings mentioned on Stack Overflow
network.host:
network.transport.tcp.port

But so far with no luck. Any hint would be appreciated.
Thx

--
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/ea988868-5f3c-4832-b521-58e6bd38e2ff%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/ea988868-5f3c-4832-b521-58e6bd38e2ff%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoE29mrr8t%2BpT-aah5kFjn4jE4va9-V4GTCVn3v5OED1ZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Hello Jakub,
you probably want to set

discovery.zen.ping.multicast.enabled: false

and then use something like

discovery.zen.ping.unicast.hosts: ["host1", "host2:port"]

In your Java code, you could use these settings on the ImmutableSettings
builder.

settings.put("discovery.zen.ping.multicast.enabled", "false");
settings.put("discovery.zen.ping.unicast.hosts.0", "host1");
settings.put("discovery.zen.ping.unicast.hosts.1", "host2:port");

I use this mechanism, e.g., to first locate the services in question in a
Zookeeper-based directory, and then fill in the necessary data as an
Elasticsearch node/client starts up.

Best regards,
--Jürgen

--
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/73a478c2-ce5d-4316-aa3b-83dbca790fe1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.