# MasterNotDiscoveredException on client

**URL:** <https://discuss.elastic.co/t/masternotdiscoveredexception-on-client/8472>\
**Category:** Elasticsearch\
**Created:** [July 20, 2012, 1:53am UTC](https://discuss.elastic.co/t/masternotdiscoveredexception-on-client/8472 "2012-07-20T01:53:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![arta](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@arta](https://discuss.elastic.co/u/arta)\
**Post date:** [July 20, 2012, 1:53am UTC](https://discuss.elastic.co/t/masternotdiscoveredexception-on-client/8472/1 "2012-07-20T01:53:35Z")

</div>

Hi,  
My client seems not able to connect to elasticsearch cluster (0.19.3).

Here's client log:  
DEBUG;[zen.ping.multicast:94][main] [Jester] using group [224.2.2.4], with port [54328], ttl [3], and address [null]  
DEBUG;[zen.ping.unicast:94][main] [Jester] using initial hosts [], with concurrent\_connects [10]  
DEBUG;[elasticsearch.discovery.zen:94][main] [Jester] using ping.timeout [2m]  
DEBUG;[discovery.zen.elect:94][main] [Jester] using minimum\_master\_nodes [-1]  
DEBUG;[discovery.zen.fd:94][main] [Jester] [master] uses ping\_interval [1s], ping\_timeout [30s], ping\_retries [3]  
DEBUG;[discovery.zen.fd:94][main] [Jester] [node] uses ping\_interval [1s], ping\_timeout [30s], ping\_retries [3]  
WARN;[org.elasticsearch.discovery:114][main] [Jester] waited for 30s and no initial state was set by the discovery  
INFO;[search.analyzer.ElasticSearchIndexer:180][main] Search cluster qa-search01  
ERROR;[search.analyzer.ElasticSearchIndexer:205][main] org.elasticsearch.discovery.MasterNotDiscoveredException: waited for [30s]

Here's server log:  
[TRACE][discovery.zen.ping.multicast] [Proteus] [1] received ping\_request from [[Jester][mVQxLCYzSQugPNA4P3T4Yg][inet[/10.3.5.21:9300]]{client=true, data=false}], sending ping\_response{target [[Proteus][\_G945VyASLyJ2FrxRs\_x7g][inet[/10.3.5.109:9300]]], master [[Proteus][\_G945VyASLyJ2FrxRs\_x7g][inet[/10.3.5.109:9300]]], cluster\_name[qa-search01]}

It seems like the server "Proteus" received the ping request from the client "Jester" and responded,  
but the client timed out (30 sec).

Is there anywhere else I should look at to investigate what is happening?

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![arta](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@arta](https://discuss.elastic.co/u/arta)\
**Post date:** [July 20, 2012, 8:09pm UTC](https://discuss.elastic.co/t/masternotdiscoveredexception-on-client/8472/2 "2012-07-20T20:09:22Z")

</div>

It is solved by adding '-Djava.net.preferIPv4Stack=true' to java command that starts the client.  
Before adding this, the multicast ping sent by the client had ttl=1, and after adding this, the ttl=3.  
I don't know why this was needed, but it works now.

Further question:

- how can I change client setting, such as multicast ttl?  
I think ttl=3 is the default. How can I change?

Can that be fed into NodeBuilder.settings(Settings)?  
If so, will that be ImmutableSettings.settingsBuilder().put("discovery.zen.ping.multicast.ttl", 4)?  
How about "discoverty.zen.ping\_timeout"? Can it be set by the same way?

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [July 20, 2012, 8:26pm UTC](https://discuss.elastic.co/t/masternotdiscoveredexception-on-client/8472/3 "2012-07-20T20:26:46Z")

</div>

You can build all your settings using settingsBuilder and then pass them to  
TransportClient:

Settings settings = ImmutableSettings.settingsBuilder()  
.put("discovery.zen.ping.multicast.ttl", 4)  
.put("client.transport.ping\_timeout", "10s")  
.put("cluster.name", "my\_cluster")  
.build();  
TransportClient client = new TransportClient(settings);

On Friday, July 20, 2012 4:09:22 PM UTC-4, arta wrote:

> It is solved by adding '-Djava.net.preferIPv4Stack=true' to java command  
> that  
> starts the client.  
> Before adding this, the multicast ping sent by the client had ttl=1, and  
> after adding this, the ttl=3.  
> I don't know why this was needed, but it works now.
> 
> Further question:
> 
> - how can I change client setting, such as multicast ttl?  
> I think ttl=3 is the default. How can I change?
> 
> Can that be fed into NodeBuilder.settings(Settings)?  
> If so, will that be  
> ImmutableSettings.settingsBuilder().put("discovery.zen.ping.multicast.ttl",
> 
> 4)?  
> How about "discoverty.zen.ping\_timeout"? Can it be set by the same way?
> 
> Thank you for your help.
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/MasterNotDiscoveredException-on-client-tp4020605p4020656.html](http://elasticsearch-users.115913.n3.nabble.com/MasterNotDiscoveredException-on-client-tp4020605p4020656.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![arta](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@arta](https://discuss.elastic.co/u/arta)\
**Post date:** [July 20, 2012, 10:27pm UTC](https://discuss.elastic.co/t/masternotdiscoveredexception-on-client/8472/4 "2012-07-20T22:27:58Z")

</div>

Thank you Igor.  
What if I use 'Node node = NodeBuilder.nodeBuilder().client(true).node();' ?  
I can't find any place I can feed ImmutableSettings in.

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [July 20, 2012, 10:35pm UTC](https://discuss.elastic.co/t/masternotdiscoveredexception-on-client/8472/5 "2012-07-20T22:35:24Z")

</div>

```
    Node node = NodeBuilder
            .nodeBuilder()
            .client(true)
            .settings(settings)
            .node();

```

On Friday, July 20, 2012 6:27:58 PM UTC-4, arta wrote:

> Thank you Igor.  
> What if I use 'Node node = NodeBuilder.nodeBuilder().client(true).node();'  
> ?  
> I can't find any place I can feed ImmutableSettings in.
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/MasterNotDiscoveredException-on-client-tp4020605p4020662.html](http://elasticsearch-users.115913.n3.nabble.com/MasterNotDiscoveredException-on-client-tp4020605p4020662.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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, 3:19am UTC](https://discuss.elastic.co/t/masternotdiscoveredexception-on-client/8472/6 "2017-07-06T03:19:35Z")

</div>


