# Trasport Client load settings

**URL:** https://discuss.elastic.co/t/trasport-client-load-settings/20746
**Category:** Elasticsearch
**Created:** [November 14, 2014, 10:07am UTC](https://discuss.elastic.co/t/trasport-client-load-settings/20746 "2014-11-14T10:07:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jakub\_Stransky](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jakub_stransky/32/732_2.png) [@Jakub\_Stransky](https://discuss.elastic.co/u/Jakub_Stransky)
#### Post date: [November 14, 2014, 10:07am UTC](https://discuss.elastic.co/t/trasport-client-load-settings/20746/1 "2014-11-14T10:07:58Z")

</div>

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](mailto: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).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [November 14, 2014, 1:58pm UTC](https://discuss.elastic.co/t/trasport-client-load-settings/20746/2 "2014-11-14T13:58:34Z")

</div>

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](mailto: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](mailto: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)  
> [https://groups.google.com/d/msgid/elasticsearch/ea988868-5f3c-4832-b521-58e6bd38e2ff%40googlegroups.com?utm\_medium=email&utm\_source=footer](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](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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoE29mrr8t%2BpT-aah5kFjn4jE4va9-V4GTCVn3v5OED1ZQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Jurgen\_Wagner\_DVT](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@Jurgen\_Wagner\_DVT](https://discuss.elastic.co/u/Jurgen_Wagner_DVT)
#### Post date: [November 16, 2014, 4:04am UTC](https://discuss.elastic.co/t/trasport-client-load-settings/20746/3 "2014-11-16T04:04:22Z")

</div>

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

---

<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, 12:49am UTC](https://discuss.elastic.co/t/trasport-client-load-settings/20746/4 "2017-07-06T00:49:48Z")

</div>


