# MasterNotDiscoveredException in JAVA! Have to change the cluster name

**URL:** <https://discuss.elastic.co/t/masternotdiscoveredexception-in-java-have-to-change-the-cluster-name/40076>\
**Category:** Elasticsearch\
**Created:** [January 26, 2016, 12:40am UTC](https://discuss.elastic.co/t/masternotdiscoveredexception-in-java-have-to-change-the-cluster-name/40076 "2016-01-26T00:40:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yongyao\_Jiang](https://avatars.discourse-cdn.com/v4/letter/y/c4cdca/32.png) [@Yongyao\_Jiang](https://discuss.elastic.co/u/Yongyao_Jiang)\
**Post date:** [January 26, 2016, 12:40am UTC](https://discuss.elastic.co/t/masternotdiscoveredexception-in-java-have-to-change-the-cluster-name/40076/1 "2016-01-26T00:40:32Z")

</div>

Hey guys,

I was doing some ES test with my Java program this morning, then strange things happened - the program can be finished successfully, but I could not find any data through Sense UI. Finally, I found out that some guy in my lab (local network) is also using ES, and the java program got connected to her cluster (I guess it is multicast).

So, I decided to change my cluster to some other name other than the default one. I did two things, one is to change the [cluster.name](http://cluster.name): test. The other is to change the code to  
Node node =  
nodeBuilder()  
.settings(ImmutableSettings.settingsBuilder().put("http.enabled", false))  
.clusterName("test")  
.client(true)  
.node();

But the MasterNotDiscoveredException came up in the end. Can someone help me? or you have some other way to solve this problem.

Thanks,  
Cody

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 26, 2016, 4:11am UTC](https://discuss.elastic.co/t/masternotdiscoveredexception-in-java-have-to-change-the-cluster-name/40076/2 "2016-01-26T04:11:53Z")

</div>

Upgrade! 🙂

You should use 2.1.1 and not 1.x series.

Also prefer the TransportClient than the node client.

---

<div class="post-metadata">

**Author:** ![Yongyao\_Jiang](https://avatars.discourse-cdn.com/v4/letter/y/c4cdca/32.png) [@Yongyao\_Jiang](https://discuss.elastic.co/u/Yongyao_Jiang)\
**Post date:** [January 26, 2016, 4:38am UTC](https://discuss.elastic.co/t/masternotdiscoveredexception-in-java-have-to-change-the-cluster-name/40076/3 "2016-01-26T04:38:51Z")

</div>

Thanks. I just got it fixed by myself after hours of googling. It turns out that I have to use the same version of es and java api. Because the java program was developed last year, I guess I have to stick with it. So I downloaded an old 1.7 es.

---

<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 5, 2017, 11:21pm UTC](https://discuss.elastic.co/t/masternotdiscoveredexception-in-java-have-to-change-the-cluster-name/40076/4 "2017-07-05T23:21:43Z")

</div>


