# EC2 discovery in Java

**URL:** <https://discuss.elastic.co/t/ec2-discovery-in-java/6405>\
**Category:** Elasticsearch\
**Created:** [January 16, 2012, 10:49pm UTC](https://discuss.elastic.co/t/ec2-discovery-in-java/6405 "2012-01-16T22:49:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slava\_G](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Slava\_G](https://discuss.elastic.co/u/Slava_G)\
**Post date:** [January 16, 2012, 10:49pm UTC](https://discuss.elastic.co/t/ec2-discovery-in-java/6405/1 "2012-01-16T22:49:44Z")

</div>

Hi,  
I've set all those parameters :  
settingBuilder.put("discovery.type", "ec2");  
settingBuilder.put("cloud.account","....");  
settingBuilder.put("cloud.key", ".....");  
settingBuilder.put("compute.type", "amazon");  
settingBuilder.put("logger.discovery", "TRACE");

and called  
NodeBuilder nodeBuilder().settings(setting).clusterName("caindexcluster").client(true).node();

After few second i got next message : [Warhawk] waited for 30s and no  
initial state was set by the discovery  
and then exception org.elasticsearch.discovery.MasterNotDiscoveredException:  
I tried to put discovery log to TRACE by setting  
this settingBuilder.put("logger.discovery", "TRACE");, but it's doesn't  
seems to work.

First question how can I enable ES log for the discovery in the java to  
TRACE  
And second , what did I miss in the configuration params.

The cluster itself is running and from the same server where this java code  
is executed calling  
curl -XGET '[http://10.190.224.44:9200/\_cluster/state?pretty=1](http://10.190.224.44:9200/_cluster/state?pretty=1)' returns:

{  
"cluster\_name" : "indexcluster",  
"master\_node" : "SHE8gNd2TY-r9GLHDtO-YQ",  
"blocks" : {  
},  
"nodes" : {  
"SHE8gNd2TY-r9GLHDtO-YQ" : {  
"name" : "Tyrannosaur",  
"transport\_address" : "inet[/10.190.224.44:9300]",  
"attributes" : {  
}  
},  
"9nCpGOiOSUuksGwTeWwTDQ" : {  
"name" : "Krystalin",  
"transport\_address" : "inet[/10.190.239.76:9300]",  
"attributes" : {  
}  
}  
},  
"metadata" : {  
"templates" : {  
},  
"indices" : {  
}  
},  
"routing\_table" : {  
"indices" : {  
}  
},  
"routing\_nodes" : {  
"unassigned" : [],  
"nodes" : {  
}  
},  
"allocations" : []  
}

Thank You.

---

<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:** [January 17, 2012, 9:56am UTC](https://discuss.elastic.co/t/ec2-discovery-in-java/6405/2 "2012-01-17T09:56:06Z")

</div>

When you are running elasticsearch embedded in your Java app, it will  
automatically use whatever logging you are using. So, configure the logging  
in your app logging config, and note, when running embedded, the logging  
categories are prefixed with org.elasticsearch.

On Tue, Jan 17, 2012 at 12:49 AM, slavag [slavago@gmail.com](mailto:slavago@gmail.com) wrote:

> Hi,  
> I've set all those parameters :  
> settingBuilder.put("discovery.type", "ec2");  
> settingBuilder.put("cloud.account","....");  
> settingBuilder.put("cloud.key", ".....");  
> settingBuilder.put("compute.type", "amazon");  
> settingBuilder.put("logger.discovery", "TRACE");
> 
> and called  
> NodeBuilder nodeBuilder().settings(setting).clusterName("caindexcluster").client(true).node();
> 
> After few second i got next message : [Warhawk] waited for 30s and no  
> initial state was set by the discovery  
> and then  
> exception org.elasticsearch.discovery.MasterNotDiscoveredException:  
> I tried to put discovery log to TRACE by setting  
> this settingBuilder.put("logger.discovery", "TRACE");, but it's doesn't  
> seems to work.
> 
> First question how can I enable ES log for the discovery in the java to  
> TRACE  
> And second , what did I miss in the configuration params.
> 
> The cluster itself is running and from the same server where this java  
> code is executed calling  
> curl -XGET '[http://10.190.224.44:9200/\_cluster/state?pretty=1](http://10.190.224.44:9200/_cluster/state?pretty=1)' returns:
> 
> {  
> "cluster\_name" : "indexcluster",  
> "master\_node" : "SHE8gNd2TY-r9GLHDtO-YQ",  
> "blocks" : {  
> },  
> "nodes" : {  
> "SHE8gNd2TY-r9GLHDtO-YQ" : {  
> "name" : "Tyrannosaur",  
> "transport\_address" : "inet[/10.190.224.44:9300]",  
> "attributes" : {  
> }  
> },  
> "9nCpGOiOSUuksGwTeWwTDQ" : {  
> "name" : "Krystalin",  
> "transport\_address" : "inet[/10.190.239.76:9300]",  
> "attributes" : {  
> }  
> }  
> },  
> "metadata" : {  
> "templates" : {  
> },  
> "indices" : {  
> }  
> },  
> "routing\_table" : {  
> "indices" : {  
> }  
> },  
> "routing\_nodes" : {  
> "unassigned" : ,  
> "nodes" : {  
> }  
> },  
> "allocations" :   
> }
> 
> Thank You.

---

<div class="post-metadata">

**Author:** ![Slava\_G](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Slava\_G](https://discuss.elastic.co/u/Slava_G)\
**Post date:** [January 17, 2012, 1:51pm UTC](https://discuss.elastic.co/t/ec2-discovery-in-java/6405/3 "2012-01-17T13:51:01Z")

</div>

Thank You.  
And problem was again EC2 security group 🙂

---

<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:42am UTC](https://discuss.elastic.co/t/ec2-discovery-in-java/6405/4 "2017-07-06T03:42:28Z")

</div>


