# 30s time delay to build the client when peer hosts not correct!

**URL:** <https://discuss.elastic.co/t/30s-time-delay-to-build-the-client-when-peer-hosts-not-correct/6662>\
**Category:** Elasticsearch\
**Created:** [February 9, 2012, 4:53pm UTC](https://discuss.elastic.co/t/30s-time-delay-to-build-the-client-when-peer-hosts-not-correct/6662 "2012-02-09T16:53:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bozena\_Wegorek](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@Bozena\_Wegorek](https://discuss.elastic.co/u/Bozena_Wegorek)\
**Post date:** [February 9, 2012, 4:53pm UTC](https://discuss.elastic.co/t/30s-time-delay-to-build-the-client-when-peer-hosts-not-correct/6662/1 "2012-02-09T16:53:00Z")

</div>

When peer nodes are not correct or dead, ES spends 30s doing nothing,  
what property configures it?  
None of these work:  
Builder builder = ImmutableSettings.settingsBuilder()  
.put(ES\_CONFIG\_CLUSTER\_PROPERTY\_KEY, this.clusterName)  
.putArray(ES\_CONFIG\_PEER\_HOSTS\_PROPERTY\_KEY,  
this.peerHosts)  
.put("discovery.zen.fd.ping\_timeout", 2)  
.put("discovery.zen.ping.timeout", 2)  
.put("discovery.zen.ping.multicast.enabled", false)  
.put("gateway.expected\_nodes", 2);

...

Here's the time wasting code:

long createTime = System.currentTimeMillis();  
node = NodeBuilder.nodeBuilder()  
.client(true)  
.settings(settings)  
.node();  
createTime = System.currentTimeMillis() - createTime;  
System.out.println("create time=" + createTime);

/\*\*\*\*\*\*\*\*\* createTime is 30s \*\*\*\*\*\*\*\*\*\*\*\*/

node.start()  
node.client()

ES version: 0.18.7

---

<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:** [February 12, 2012, 11:22am UTC](https://discuss.elastic.co/t/30s-time-delay-to-build-the-client-when-peer-hosts-not-correct/6662/2 "2012-02-12T11:22:07Z")

</div>

The node will wait for a proper discovery to happen (finding a master node) on startup, by default, it is 30 seconds. You can configure that by setting discovery.initial\_state\_timeout setting.

On Thursday, February 9, 2012 at 6:53 PM, Bozena Wegorek wrote:

> When peer nodes are not correct or dead, ES spends 30s doing nothing,  
> what property configures it?  
> None of these work:  
> Builder builder = ImmutableSettings.settingsBuilder()  
> .put(ES\_CONFIG\_CLUSTER\_PROPERTY\_KEY, this.clusterName)  
> .putArray(ES\_CONFIG\_PEER\_HOSTS\_PROPERTY\_KEY,  
> this.peerHosts)  
> .put("discovery.zen.fd.ping\_timeout", 2)  
> .put("discovery.zen.ping.timeout", 2)  
> .put("discovery.zen.ping.multicast.enabled", false)  
> .put("gateway.expected\_nodes", 2);
> 
> ...
> 
> Here's the time wasting code:
> 
> long createTime = System.currentTimeMillis();  
> node = NodeBuilder.nodeBuilder()  
> .client(true)  
> .settings(settings)  
> .node();  
> createTime = System.currentTimeMillis() - createTime;  
> System.out.println("create time=" + createTime);
> 
> /\*\*\*\*\*\*\*\*\* createTime is 30s \*\*\*\*\*\*\*\*\*\*\*\*/
> 
> node.start()  
> node.client()
> 
> ES version: 0.18.7

---

<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:39am UTC](https://discuss.elastic.co/t/30s-time-delay-to-build-the-client-when-peer-hosts-not-correct/6662/3 "2017-07-06T03:39:49Z")

</div>


