# Can't get Java client to join cloud-aws cluster

**URL:** <https://discuss.elastic.co/t/cant-get-java-client-to-join-cloud-aws-cluster/7799>\
**Category:** Elasticsearch\
**Created:** [May 22, 2012, 2:06am UTC](https://discuss.elastic.co/t/cant-get-java-client-to-join-cloud-aws-cluster/7799 "2012-05-22T02:06:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [May 22, 2012, 2:06am UTC](https://discuss.elastic.co/t/cant-get-java-client-to-join-cloud-aws-cluster/7799/1 "2012-05-22T02:06:44Z")

</div>

I have an elasticsearch instance running on an EC2 machine with the  
following elasticsearch.yml:

cluster.name: test

plugin.mandatory: cloud-aws

cloud:  
aws:  
access\_key: xxxxxxxxxxxx  
secret\_key: xxxxxxxxxxxx  
region: us-east-1

discovery:  
type: ec2

The instance seems to be fine; `curl localhost:9200/_cluster/health? pretty=true` returns:

{  
"cluster\_name" : "test",  
"status" : "green",  
"timed\_out" : false,  
"number\_of\_nodes" : 1,  
"number\_of\_data\_nodes" : 1,  
"active\_primary\_shards" : 0,  
"active\_shards" : 0,  
"relocating\_shards" : 0,  
"initializing\_shards" : 0,  
"unassigned\_shards" : 0  
}

Here's how I try to connect to the cluster from my application:

ImmutableSettings.Builder settings =  
ImmutableSettings.settingsBuilder()  
.put("cloud.aws.access\_key", "xxxxxxxxxxxx")  
.put("cloud.aws.secret\_key", "xxxxxxxxxxxx")  
.put("cloud.aws.region", "us-east-1")  
.put("discovery.type", "ec2");

return NodeBuilder.nodeBuilder()  
.clusterName("test")  
.client(true).local(false)  
.settings(settings.build()).node();

But I get the following error after 30s--even when running on the same  
machine:

[warn] o.e.discovery - [Venomm] waited for 30s and no initial state  
was set by the discovery

Any ideas what I'm missing?

---

<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:** [May 22, 2012, 4:59am UTC](https://discuss.elastic.co/t/cant-get-java-client-to-join-cloud-aws-cluster/7799/2 "2012-05-22T04:59:16Z")

</div>

Did you open 9300 port on your EC2 instance ?

David

Le 22 mai 2012 à 04:06, Eric Jain [eric.jain@gmail.com](mailto:eric.jain@gmail.com) a écrit :

> I have an elasticsearch instance running on an EC2 machine with the  
> following elasticsearch.yml:
> 
> cluster.name: test
> 
> plugin.mandatory: cloud-aws
> 
> cloud:  
> aws:  
> access\_key: xxxxxxxxxxxx  
> secret\_key: xxxxxxxxxxxx  
> region: us-east-1
> 
> discovery:  
> type: ec2
> 
> The instance seems to be fine; `curl localhost:9200/_cluster/health? pretty=true` returns:
> 
> {  
> "cluster\_name" : "test",  
> "status" : "green",  
> "timed\_out" : false,  
> "number\_of\_nodes" : 1,  
> "number\_of\_data\_nodes" : 1,  
> "active\_primary\_shards" : 0,  
> "active\_shards" : 0,  
> "relocating\_shards" : 0,  
> "initializing\_shards" : 0,  
> "unassigned\_shards" : 0  
> }
> 
> Here's how I try to connect to the cluster from my application:
> 
> ImmutableSettings.Builder settings =  
> ImmutableSettings.settingsBuilder()  
> .put("cloud.aws.access\_key", "xxxxxxxxxxxx")  
> .put("cloud.aws.secret\_key", "xxxxxxxxxxxx")  
> .put("cloud.aws.region", "us-east-1")  
> .put("discovery.type", "ec2");
> 
> return NodeBuilder.nodeBuilder()  
> .clusterName("test")  
> .client(true).local(false)  
> .settings(settings.build()).node();
> 
> But I get the following error after 30s--even when running on the same  
> machine:
> 
> [warn] o.e.discovery - [Venomm] waited for 30s and no initial state  
> was set by the discovery
> 
> Any ideas what I'm missing?

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [May 22, 2012, 6:47am UTC](https://discuss.elastic.co/t/cant-get-java-client-to-join-cloud-aws-cluster/7799/3 "2012-05-22T06:47:20Z")

</div>

On Mon, May 21, 2012 at 9:59 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Did you open 9300 port on your EC2 instance ?

Thanks, that was indeed the issue. Hadn't thought I'd need to open any  
ports to make this work on a single machine...

btw I had to open ports 9300-9400 within the ec2 security group to  
avoid subsequent errors; couldn't find any mention of this in the docs  
or in [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/tutorials/2011/08/22/elasticsearch-on-ec2.html)

---

<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:** [May 23, 2012, 10:51pm UTC](https://discuss.elastic.co/t/cant-get-java-client-to-join-cloud-aws-cluster/7799/4 "2012-05-23T22:51:03Z")

</div>

Opening just 9300 is enough, unless you run more than one ES instance on  
that node (in which case the additional nodes will start ot use port 9301,  
9302, and so on).

On Tue, May 22, 2012 at 8:47 AM, Eric Jain [eric.jain@gmail.com](mailto:eric.jain@gmail.com) wrote:

> On Mon, May 21, 2012 at 9:59 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > Did you open 9300 port on your EC2 instance ?
> 
> Thanks, that was indeed the issue. Hadn't thought I'd need to open any  
> ports to make this work on a single machine...
> 
> btw I had to open ports 9300-9400 within the ec2 security group to  
> avoid subsequent errors; couldn't find any mention of this in the docs  
> or in  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/tutorials/2011/08/22/elasticsearch-on-ec2.html)

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [May 24, 2012, 12:37am UTC](https://discuss.elastic.co/t/cant-get-java-client-to-join-cloud-aws-cluster/7799/5 "2012-05-24T00:37:35Z")

</div>

On Wed, May 23, 2012 at 3:51 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Opening just 9300 is enough, unless you run more than one ES instance on  
> that node (in which case the additional nodes will start ot use port 9301,  
> 9302, and so on).

I was running a single elasticsearch standalone instance per machine +  
a Java application that creates a Node with client(true).

---

<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:** [May 25, 2012, 10:42pm UTC](https://discuss.elastic.co/t/cant-get-java-client-to-join-cloud-aws-cluster/7799/6 "2012-05-25T22:42:50Z")

</div>

A node client also opens a transport channel...

On Thu, May 24, 2012 at 2:37 AM, Eric Jain [eric.jain@gmail.com](mailto:eric.jain@gmail.com) wrote:

> On Wed, May 23, 2012 at 3:51 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > Opening just 9300 is enough, unless you run more than one ES instance on  
> > that node (in which case the additional nodes will start ot use port  
> > 9301,  
> > 9302, and so on).
> 
> I was running a single elasticsearch standalone instance per machine +  
> a Java application that creates a Node with client(true).

---

<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:26am UTC](https://discuss.elastic.co/t/cant-get-java-client-to-join-cloud-aws-cluster/7799/7 "2017-07-06T03:26:55Z")

</div>


