# How to set cluster name on Transport Client

**URL:** <https://discuss.elastic.co/t/how-to-set-cluster-name-on-transport-client/3552>\
**Category:** Elasticsearch\
**Created:** [November 10, 2010, 8:15pm UTC](https://discuss.elastic.co/t/how-to-set-cluster-name-on-transport-client/3552 "2010-11-10T20:15:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diptamay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/diptamay/32/2805_2.png) [@Diptamay](https://discuss.elastic.co/u/Diptamay)\
**Post date:** [November 10, 2010, 8:15pm UTC](https://discuss.elastic.co/t/how-to-set-cluster-name-on-transport-client/3552/1 "2010-11-10T20:15:55Z")

</div>

Hi

I am having problems connecting to the ES cluster using the java api  
TransportClient, as soon as I configured the ES servers using a  
cluster.name. I am guessing my TransportClient is looking for the  
cluster with name "elasticsearch". So my question is, how do I set the  
cluster name on TransportClient. I know NodeBuilder has a method  
clusterName(), but did not see anything similar for TransportClient.

My ES configuration loos like this. Btw, I am running the latest trunk  
build of ES.

cluster:  
name: sanyal  
gateway:  
type: fs  
fs:  
location: /Users/sanyal/Documents/workspace/hb\_indices  
index:  
memory:  
enabled: true  
gateway:  
snapshot\_interval : 30s  
store:  
type: niofs  
number\_of\_shards : 2  
number\_of\_replicas : 1  
path:  
home: /Users/sanyal/Installs/elasticsearch  
logs: /Users/sanyal/Documents/workspace/logs

The stacktrace from my application here:

STAGE:[2010-11-10 14:57:16,779][DEBUG]  
[com.bamnetworks.cms.search.ItemSearchService] Default item search  
STAGE:[2010-11-10 14:57:16,839][DEBUG]  
[com.bamnetworks.cms.search.request.mappers.esearch.ItemSearchRequestMapper]  
org.elasticsearch.client.action.search.SearchRequestBuilder@62c8aeb3  
STAGE:[2010-11-10 14:57:16,995][ERROR]  
[com.bamnetworks.cms.search.handlers.esearch.ItemSearchHandler] Error  
getting ItemSearchRequest{ Request{ index='hb-stage'}  
searchParams=com.bamnetworks.cms.types.SearchParams@57bd06bf}  
org.elasticsearch.client.transport.NoNodeAvailableException: No node  
available  
at  
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:  
138)  
at  
org.elasticsearch.client.transport.support.InternalTransportClient.search(InternalTransportClient.java:  
232)  
at  
org.elasticsearch.client.transport.TransportClient.search(TransportClient.java:  
290)  
at  
org.elasticsearch.client.action.search.SearchRequestBuilder.doExecute(SearchRequestBuilder.java:  
413)  
at  
org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:  
56)  
at  
org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:  
51)  
at  
com.bamnetworks.cms.search.handlers.esearch.ItemSearchHandler.process(ItemSearchHandler.java:  
32)

Thanks  
Diptamay

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 10, 2010, 10:58pm UTC](https://discuss.elastic.co/t/how-to-set-cluster-name-on-transport-client/3552/2 "2010-11-10T22:58:50Z")

</div>

You need to pass settings to the TransportClient, and set cluser.name to you  
cluster name. Use the ImmutableSettings builder to create it.

On Wed, Nov 10, 2010 at 10:15 PM, diptamay [diptamay@gmail.com](mailto:diptamay@gmail.com) wrote:

> Hi
> 
> I am having problems connecting to the ES cluster using the java api  
> TransportClient, as soon as I configured the ES servers using a  
> cluster.name. I am guessing my TransportClient is looking for the  
> cluster with name "elasticsearch". So my question is, how do I set the  
> cluster name on TransportClient. I know NodeBuilder has a method  
> clusterName(), but did not see anything similar for TransportClient.
> 
> My ES configuration loos like this. Btw, I am running the latest trunk  
> build of ES.
> 
> cluster:  
> name: sanyal  
> gateway:  
> type: fs  
> fs:  
> location: /Users/sanyal/Documents/workspace/hb\_indices  
> index:  
> memory:  
> enabled: true  
> gateway:  
> snapshot\_interval : 30s  
> store:  
> type: niofs  
> number\_of\_shards : 2  
> number\_of\_replicas : 1  
> path:  
> home: /Users/sanyal/Installs/elasticsearch  
> logs: /Users/sanyal/Documents/workspace/logs
> 
> The stacktrace from my application here:
> 
> STAGE:[2010-11-10 14:57:16,779][DEBUG]  
> [com.bamnetworks.cms.search.ItemSearchService] Default item search  
> STAGE:[2010-11-10 14:57:16,839][DEBUG]
> 
> [com.bamnetworks.cms.search.request.mappers.esearch.ItemSearchRequestMapper]  
> org.elasticsearch.client.action.search.SearchRequestBuilder@62c8aeb3  
> STAGE:[2010-11-10 14:57:16,995][ERROR]  
> [com.bamnetworks.cms.search.handlers.esearch.ItemSearchHandler] Error  
> getting ItemSearchRequest{ Request{ index='hb-stage'}  
> searchParams=com.bamnetworks.cms.types.SearchParams@57bd06bf}  
> org.elasticsearch.client.transport.NoNodeAvailableException: No node  
> available  
> at
> 
> org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:  
> 138)  
> at
> 
> org.elasticsearch.client.transport.support.InternalTransportClient.search(InternalTransportClient.java:  
> 232)  
> at
> 
> org.elasticsearch.client.transport.TransportClient.search(TransportClient.java:  
> 290)  
> at
> 
> org.elasticsearch.client.action.search.SearchRequestBuilder.doExecute(SearchRequestBuilder.java:  
> 413)  
> at
> 
> org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:  
> 56)  
> at
> 
> org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:  
> 51)  
> at
> 
> com.bamnetworks.cms.search.handlers.esearch.ItemSearchHandler.process(ItemSearchHandler.java:  
> 32)
> 
> Thanks  
> Diptamay

---

<div class="post-metadata">

**Author:** ![Diptamay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/diptamay/32/2805_2.png) [@Diptamay](https://discuss.elastic.co/u/Diptamay)\
**Post date:** [November 11, 2010, 2:15am UTC](https://discuss.elastic.co/t/how-to-set-cluster-name-on-transport-client/3552/3 "2010-11-11T02:15:44Z")

</div>

Thanks. That worked for me.

On Nov 10, 5:58 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> You need to pass settings to the TransportClient, and set cluser.name to you  
> cluster name. Use the ImmutableSettings builder to create it.
> 
> On Wed, Nov 10, 2010 at 10:15 PM, diptamay [dipta...@gmail.com](mailto:dipta...@gmail.com) wrote:
> 
> > Hi
> 
> > I am having problems connecting to the ES cluster using the java api  
> > TransportClient, as soon as I configured the ES servers using a  
> > cluster.name. I am guessing my TransportClient is looking for the  
> > cluster with name "elasticsearch". So my question is, how do I set the  
> > cluster name on TransportClient. I know NodeBuilder has a method  
> > clusterName(), but did not see anything similar for TransportClient.
> 
> > My ES configuration loos like this. Btw, I am running the latest trunk  
> > build of ES.
> 
> > cluster:  
> > name: sanyal  
> > gateway:  
> > type: fs  
> > fs:  
> > location: /Users/sanyal/Documents/workspace/hb\_indices  
> > index:  
> > memory:  
> > enabled: true  
> > gateway:  
> > snapshot\_interval : 30s  
> > store:  
> > type: niofs  
> > number\_of\_shards : 2  
> > number\_of\_replicas : 1  
> > path:  
> > home: /Users/sanyal/Installs/elasticsearch  
> > logs: /Users/sanyal/Documents/workspace/logs
> 
> > The stacktrace from my application here:
> 
> > STAGE:[2010-11-10 14:57:16,779][DEBUG]  
> > [com.bamnetworks.cms.search.ItemSearchService] Default item search  
> > STAGE:[2010-11-10 14:57:16,839][DEBUG]
> 
> > [com.bamnetworks.cms.search.request.mappers.esearch.ItemSearchRequestMapper]  
> > org.elasticsearch.client.action.search.SearchRequestBuilder@62c8aeb3  
> > STAGE:[2010-11-10 14:57:16,995][ERROR]  
> > [com.bamnetworks.cms.search.handlers.esearch.ItemSearchHandler] Error  
> > getting ItemSearchRequest{ Request{ index='hb-stage'}  
> > searchParams=com.bamnetworks.cms.types.SearchParams@57bd06bf}  
> > org.elasticsearch.client.transport.NoNodeAvailableException: No node  
> > available  
> > at
> 
> > org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:  
> > 138)  
> > at
> 
> > org.elasticsearch.client.transport.support.InternalTransportClient.search(InternalTransportClient.java:  
> > 232)  
> > at
> 
> > org.elasticsearch.client.transport.TransportClient.search(TransportClient.java:  
> > 290)  
> > at
> 
> > org.elasticsearch.client.action.search.SearchRequestBuilder.doExecute(SearchRequestBuilder.java:  
> > 413)  
> > at
> 
> > org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:  
> > 56)  
> > at
> 
> > org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:  
> > 51)  
> > at
> 
> > com.bamnetworks.cms.search.handlers.esearch.ItemSearchHandler.process(ItemSearchHandler.java:  
> > 32)
> 
> > Thanks  
> > Diptamay

---

<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, 4:16am UTC](https://discuss.elastic.co/t/how-to-set-cluster-name-on-transport-client/3552/4 "2017-07-06T04:16:44Z")

</div>


